mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-04 03:18:19 +00:00
5a2154de38
Change-Id: I8d96b69e8c15bc8ad84cfb0c511396e5b3e7ac20
29 lines
953 B
JavaScript
29 lines
953 B
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWReferenceGroupInputWidget (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'Constructor', ( assert ) => {
|
|
const widget = new ve.ui.MWReferenceGroupInputWidget( {
|
|
emptyGroupName: '—'
|
|
} );
|
|
assert.strictEqual( widget.emptyGroupName, '—' );
|
|
assert.strictEqual( widget.getMenu().getItemCount(), 0 );
|
|
} );
|
|
|
|
QUnit.test( 'populateMenu', ( 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' );
|
|
} );
|