Fix issues raised through TestSwarm
authorKrinkle <krinkle@users.mediawiki.org>
Sun, 29 May 2011 04:11:10 +0000 (04:11 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Sun, 29 May 2011 04:11:10 +0000 (04:11 +0000)
* Instead of delete window.foobar whitelist the global in QUnit.config.pollution
** the reason either is needed is to make QUnit's "noglobal" option useful)
** delete window.foo throws an "TypeError: Object doesn't support this action" in Internet Explorer.
-> http://perfectionkills.com/understanding-delete/
* Remove other globals introduced

resources/mediawiki/mediawiki.js
tests/qunit/suites/resources/mediawiki.util/mediawiki.util.js
tests/qunit/suites/resources/mediawiki/mediawiki.js

index 2a65c6c..05fde3f 100644 (file)
@@ -246,11 +246,12 @@ window.mediaWiki = new ( function( $ ) {
         * Gets a message object, similar to wfMessage()
         *
         * @param key string Key of message to get
-        * @param parameters mixed First argument in a list of variadic arguments,
+        * @param parameter_1 mixed First argument in a list of variadic arguments,
         * each a parameter for $N replacement in messages.
         * @return Message
         */
        this.message = function( key, parameter_1 /* [, parameter_2] */ ) {
+               var parameters;
                // Support variadic arguments
                if ( parameter_1 !== undefined ) {
                        parameters = $.makeArray( arguments );
index 68ce17c..0b32b49 100644 (file)
@@ -50,7 +50,7 @@ test( 'wikiScript', function(){
 test( 'addCSS', function(){
        expect(3);
 
-       window.a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' );
+       var a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' );
        ok(  a, 'function works' );
        deepEqual( a.disabled, false, 'property "disabled" is available and set to false' );
 
index 150dd78..c2a6af5 100644 (file)
@@ -64,8 +64,8 @@ test( 'mw.Map', function(){
        deepEqual( 'anotherGlobalMapChecker' in window, true, 'new mw.Map( true ) did store its values in the global window object' );
        ok( window.anotherGlobalMapChecker, 'new mw.Map( true ) did store its values in the global window object' );
 
-       // Clean up
-       delete window.anotherGlobalMapChecker;
+       // Whitelist this global variable for QUnit 'noglobal' mode
+       QUnit.config.pollution.push( 'anotherGlobalMapChecker' );
 });
 
 test( 'mw.config', function(){
@@ -111,6 +111,7 @@ test( 'mw.messages / mw.message / mw.msg', function(){
        deepEqual( goodbye.exists(), false, 'Message.exists() returns false for inexisting messages' );
 
        equal( goodbye.toString(), '<goodbye>', 'Message.toString() returns <key> if key does not exist' );
+
 });
 
 test( 'mw.msg', function(){