plupload
Version:
Plupload is a JavaScript API for dealing with file uploads it supports features like multiple file selection, file type filtering, request chunking, client side image scaling and it uses different runtimes to achieve this such as HTML 5, Silverlight and F
72 lines (58 loc) • 2 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Plupload: Test AMD</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//code.jquery.com/qunit/qunit-1.14.0.js"></script>
<script src="../js/testrunner/reporter.js"></script>
<script src="../js/require.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
<script type="text/javascript">
var matches = document.location.search.match(/src=(min|dev)/);
var mode = matches ? matches[1] : 'min';
requirejs.config({
"baseUrl": "../../js/",
"paths": {
"moxie": "moxie",
"plupload": "plupload." + mode
}
});
module("AMD", {
setup: function() {
$('#qunit-fixture').html('<div id="uploader" />');
this.options = {
browse_button: 'uploader',
drop_element: 'uploader',
container: 'qunit-fixture',
url: "Plupload/upload.php"
};
this.up = null;
},
teardown: function() {
if (this.up) {
this.up.destroy();
}
}
});
test("test AMD loader", function() {
var self = this;
QUnit.stop();
require(['moxie', 'plupload'], function(moxie, plupload) {
self.up = new plupload.Uploader(self.options);
self.up.bind('Init', function() {
QUnit.start();
ok(true, "Plupload loaded and initialised.");
ok(/^moxie_event_target_/.test(moxie.runtime.Runtime.getGlobalEventTarget()),
"Global event target has been redifined.");
});
self.up.init();
});
});
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture" style="position: relative; top: 0 !important; left: 0 !important; width: 100%; height: 9px;"></div>
</body>
</html>