http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88705

Revision: 88705
Author:   krinkle
Date:     2011-05-24 00:21:42 +0000 (Tue, 24 May 2011)
Log Message:
-----------
Rewriting mw.loader test suite. The previous one didn't work properly in 
IE6-IE8.

Modified Paths:
--------------
    trunk/phase3/tests/qunit/sample/awesome.js
    trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js

Modified: trunk/phase3/tests/qunit/sample/awesome.js
===================================================================
--- trunk/phase3/tests/qunit/sample/awesome.js  2011-05-23 23:10:46 UTC (rev 
88704)
+++ trunk/phase3/tests/qunit/sample/awesome.js  2011-05-24 00:21:42 UTC (rev 
88705)
@@ -1 +1,4 @@
-window.awesome = true;
+window.mw.loader.testCallback = function(){
+       start();
+       deepEqual( true, true, 'Implementing a module, is the callback timed 
properly ?');
+};

Modified: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js
===================================================================
--- trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js    
2011-05-23 23:10:46 UTC (rev 88704)
+++ trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js    
2011-05-24 00:21:42 UTC (rev 88705)
@@ -90,20 +90,22 @@
                "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!');
        });
 
 });


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to