Rewriting mw.loader test suite. The previous one didn't work properly in IE6-IE8.
authorKrinkle <krinkle@users.mediawiki.org>
Tue, 24 May 2011 00:21:42 +0000 (00:21 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Tue, 24 May 2011 00:21:42 +0000 (00:21 +0000)
tests/qunit/sample/awesome.js
tests/qunit/suites/resources/mediawiki/mediawiki.js

index 61fbbc7..3adc270 100644 (file)
@@ -1 +1,4 @@
-window.awesome = true;
+window.mw.loader.testCallback = function(){
+       start();
+       deepEqual( true, true, 'Implementing a module, is the callback timed properly ?');
+};
index 24c6c92..e3fc18a 100644 (file)
@@ -90,20 +90,22 @@ test( 'mw.loader', function(){
                "Extracting path from local URL (file://) with fragment"
                );
 
+       // Asynchronous ahead
        stop();
 
-       var tests_path = rePath.exec( location.href ); // Extract path
+       // Extract path
+       var tests_path = rePath.exec( location.href );
+
        mw.loader.implement( 'is.awesome', [tests_path + 'sample/awesome.js'], {}, {} );
+
        mw.loader.using( 'is.awesome', function(){
-               start();
-               deepEqual( window.awesome, true, 'Implementing a module, is the callback timed properly ?');
 
-               // Clean up
-               delete window.awesome;
+               // awesome.js declares this function
+               mw.loader.testCallback();
 
        }, function(){
                start();
-               deepEqual( 'mw.loader.using error callback fired', true, 'Implementing a module, is the callback timed properly ?');
+               deepEqual( true, false, 'Implementing a module, error callback fired!');
        });
 
 });