X-Git-Url: http://git.cyclocoop.org/%24action?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki%2Fmediawiki.test.js;h=6ee49013c6e19f1c8c986e45d1fe159c5a585595;hb=e681e5d8c974914f957e24fd29de5caf160152fb;hp=ab463a9720f171891dccd8f75e65869bff291a72;hpb=a303296f2730d6279a249bde77f3e0b9b42e494f;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.test.js index ab463a9720..6ee49013c6 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.test.js @@ -65,10 +65,11 @@ ); } ); - QUnit.test( 'mw.Map', 35, function ( assert ) { + QUnit.test( 'mw.Map', function ( assert ) { var arry, conf, funky, globalConf, nummy, someValues; conf = new mw.Map(); + // Dummy variables funky = function () {}; arry = []; @@ -126,15 +127,15 @@ lorem: 'ipsum' }, 'Map.get returns multiple values correctly as an object' ); - assert.deepEqual( conf, new mw.Map( conf.values ), 'new mw.Map maps over existing values-bearing object' ); - assert.deepEqual( conf.get( [ 'foo', 'notExist' ] ), { foo: 'bar', notExist: null }, 'Map.get return includes keys that were not found as null values' ); // Interacting with globals and accessing the values object + this.suppressWarnings(); assert.strictEqual( conf.get(), conf.values, 'Map.get returns the entire values object by reference (if called without arguments)' ); + this.restoreWarnings(); conf.set( 'globalMapChecker', 'Hi' ); @@ -170,11 +171,7 @@ } } ); - QUnit.test( 'mw.config', 1, function ( assert ) { - assert.ok( mw.config instanceof mw.Map, 'mw.config instance of mw.Map' ); - } ); - - QUnit.test( 'mw.message & mw.messages', 100, function ( assert ) { + QUnit.test( 'mw.message & mw.messages', function ( assert ) { var goodbye, hello; // Convenience method for asserting the same result for multiple formats @@ -189,7 +186,6 @@ } assert.ok( mw.messages, 'messages defined' ); - assert.ok( mw.messages instanceof mw.Map, 'mw.messages instance of mw.Map' ); assert.ok( mw.messages.set( 'hello', 'Hello awesome world' ), 'mw.messages.set: Register' ); hello = mw.message( 'hello' ); @@ -243,9 +239,7 @@ goodbye = mw.message( 'goodbye' ); assert.strictEqual( goodbye.exists(), false, 'Message.exists returns false for nonexistent messages' ); - assertMultipleFormats( [ 'goodbye' ], [ 'plain', 'text' ], '', 'Message.toString returns if key does not exist' ); - // bug 30684 - assertMultipleFormats( [ 'goodbye' ], [ 'parse', 'escaped' ], '<goodbye>', 'Message.toString returns properly escaped <key> if key does not exist' ); + assertMultipleFormats( [ 'good<>bye' ], [ 'plain', 'text', 'parse', 'escaped' ], '⧼good<>bye⧽', 'Message.toString returns ⧽key⧽ if key does not exist' ); assert.ok( mw.messages.set( 'plural-test-msg', 'There {{PLURAL:$1|is|are}} $1 {{PLURAL:$1|result|results}}' ), 'mw.messages.set: Register' ); assertMultipleFormats( [ 'plural-test-msg', 6 ], [ 'text', 'parse', 'escaped' ], 'There are 6 results', 'plural get resolved' ); @@ -324,7 +318,7 @@ QUnit.test( 'mw.msg', 14, function ( assert ) { assert.ok( mw.messages.set( 'hello', 'Hello awesome world' ), 'mw.messages.set: Register' ); assert.equal( mw.msg( 'hello' ), 'Hello awesome world', 'Gets message with default options (existing message)' ); - assert.equal( mw.msg( 'goodbye' ), '', 'Gets message with default options (nonexistent message)' ); + assert.equal( mw.msg( 'goodbye' ), '⧼goodbye⧽', 'Gets message with default options (nonexistent message)' ); assert.ok( mw.messages.set( 'plural-item', 'Found $1 {{PLURAL:$1|item|items}}' ), 'mw.messages.set: Register' ); assert.equal( mw.msg( 'plural-item', 5 ), 'Found 5 items', 'Apply plural for count 5' );