mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-20 18:42:41 +00:00
b02028b671
It's just hard to find and confusing when hidden in that sub-directory. Bug: T358851 Change-Id: I19ffe73b79fa9add52af12f477afe7abbc6db836
29 lines
965 B
JavaScript
29 lines
965 B
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWReferenceGroupInputWidget (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'Constructor', function ( assert ) {
|
|
const widget = new ve.ui.MWReferenceGroupInputWidget( {
|
|
emptyGroupName: '—'
|
|
} );
|
|
assert.strictEqual( widget.emptyGroupName, '—' );
|
|
assert.strictEqual( widget.getMenu().getItemCount(), 0 );
|
|
} );
|
|
|
|
QUnit.test( 'populateMenu', function ( assert ) {
|
|
const doc = ve.dm.citeExample.createExampleDocument( 'references' );
|
|
|
|
const widget = new ve.ui.MWReferenceGroupInputWidget( {
|
|
emptyGroupName: 'empty'
|
|
} );
|
|
widget.populateMenu( doc.getInternalList() );
|
|
|
|
assert.strictEqual( widget.getMenu().getItemCount(), 2 );
|
|
|
|
assert.strictEqual( widget.getMenu().items[ 0 ].getData(), '' );
|
|
assert.strictEqual( widget.getMenu().items[ 0 ].getLabel(), 'empty' );
|
|
|
|
assert.strictEqual( widget.getMenu().items[ 1 ].getData(), 'foo' );
|
|
assert.strictEqual( widget.getMenu().items[ 1 ].getLabel(), 'foo' );
|
|
} );
|