);
} );
- 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 = [];
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' );
}
} );
- 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
}
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 <b>awesome</b> world' ), 'mw.messages.set: Register' );
hello = mw.message( 'hello' );
goodbye = mw.message( 'goodbye' );
assert.strictEqual( goodbye.exists(), false, 'Message.exists returns false for nonexistent messages' );
- assertMultipleFormats( [ 'goodbye' ], [ 'plain', 'text' ], '<goodbye>', 'Message.toString returns <key> 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' );
QUnit.test( 'mw.msg', 14, function ( assert ) {
assert.ok( mw.messages.set( 'hello', 'Hello <b>awesome</b> world' ), 'mw.messages.set: Register' );
assert.equal( mw.msg( 'hello' ), 'Hello <b>awesome</b> world', 'Gets message with default options (existing message)' );
- assert.equal( mw.msg( 'goodbye' ), '<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' );