Index: trunk/phase3/tests/qunit/sample/awesome.js |
— | — | @@ -1 +1,4 @@ |
2 | | -window.awesome = true; |
| 2 | +window.mw.loader.testCallback = function(){ |
| 3 | + start(); |
| 4 | + deepEqual( true, true, 'Implementing a module, is the callback timed properly ?'); |
| 5 | +}; |
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js |
— | — | @@ -90,20 +90,22 @@ |
91 | 91 | "Extracting path from local URL (file://) with fragment" |
92 | 92 | ); |
93 | 93 | |
| 94 | + // Asynchronous ahead |
94 | 95 | stop(); |
95 | 96 | |
96 | | - var tests_path = rePath.exec( location.href ); // Extract path |
| 97 | + // Extract path |
| 98 | + var tests_path = rePath.exec( location.href ); |
| 99 | + |
97 | 100 | mw.loader.implement( 'is.awesome', [tests_path + 'sample/awesome.js'], {}, {} ); |
| 101 | + |
98 | 102 | mw.loader.using( 'is.awesome', function(){ |
99 | | - start(); |
100 | | - deepEqual( window.awesome, true, 'Implementing a module, is the callback timed properly ?'); |
101 | 103 | |
102 | | - // Clean up |
103 | | - delete window.awesome; |
| 104 | + // awesome.js declares this function |
| 105 | + mw.loader.testCallback(); |
104 | 106 | |
105 | 107 | }, function(){ |
106 | 108 | start(); |
107 | | - deepEqual( 'mw.loader.using error callback fired', true, 'Implementing a module, is the callback timed properly ?'); |
| 109 | + deepEqual( true, false, 'Implementing a module, error callback fired!'); |
108 | 110 | }); |
109 | 111 | |
110 | 112 | }); |