mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-12-21 20:32:58 +00:00
6856ef8b5e
Updates QUnit test files from starting with "test_" to ending with "test.js" in accordance with the Readers Wed coding conventions. https://www.mediawiki.org/wiki/Reading/Web/Coding_conventions Bug: T197884 Change-Id: I3c15385d22d308b8b465985ca55e8b802d72dae4
36 lines
873 B
JavaScript
36 lines
873 B
JavaScript
( function () {
|
|
'use strict';
|
|
|
|
var CardModel = mw.cards.CardModel;
|
|
|
|
QUnit.module( 'ext.relatedArticles.cards/CardModel' );
|
|
|
|
QUnit.test( '#set', function ( assert ) {
|
|
var model = new CardModel( {} );
|
|
|
|
model.on( 'change', function ( attributes ) {
|
|
assert.strictEqual(
|
|
attributes.foo,
|
|
'bar',
|
|
'It emits an event with the attribute that has changed.'
|
|
);
|
|
} );
|
|
model.set( 'foo', 'bar' );
|
|
|
|
model = new CardModel( {} );
|
|
model.on( 'change', function () {
|
|
assert.ok( false, 'It doesn\'t emit an event when silenced.' );
|
|
} );
|
|
|
|
model.set( 'foo', 'bar', true );
|
|
} );
|
|
|
|
QUnit.test( '#get', function ( assert ) {
|
|
var model = new CardModel( {} );
|
|
|
|
model.set( 'foo', 'bar' );
|
|
assert.strictEqual( model.get( 'foo' ), 'bar', 'Got the correct value.' );
|
|
assert.strictEqual( model.get( 'x' ), undefined, 'Got the correct value.' );
|
|
} );
|
|
}() );
|