blob: 288b527b6492f6e6a394cfa90f60709537cc5830 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
( function ( mw ) {
var TEST_MODEL = 'test-content-model';
QUnit.module( 'mediawiki.messagePoster', QUnit.newMwEnvironment( {
teardown: function () {
mw.messagePoster.factory.unregister( TEST_MODEL );
}
} ) );
QUnit.test( 'register', 2, function ( assert ) {
var testMessagePosterConstructor = function () {};
mw.messagePoster.factory.register( TEST_MODEL, testMessagePosterConstructor );
assert.strictEqual(
mw.messagePoster.factory.contentModelToClass[ TEST_MODEL ],
testMessagePosterConstructor,
'Constructor is registered'
);
assert.throws(
function () {
mw.messagePoster.factory.register( TEST_MODEL, testMessagePosterConstructor );
},
new RegExp( 'The content model \'' + TEST_MODEL + '\' is already registered.' ),
'Throws exception is same model is registered a second time'
);
} );
}( mediaWiki ) );
|