| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <!DOCTYPE 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>
|