mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-03 11:06:17 +00:00
5a2154de38
Change-Id: I8d96b69e8c15bc8ad84cfb0c511396e5b3e7ac20
33 lines
996 B
JavaScript
33 lines
996 B
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWUseExistingReferenceCommand (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'Constructor', ( assert ) => {
|
|
const command = new ve.ui.MWUseExistingReferenceCommand();
|
|
assert.strictEqual( command.name, 'reference/existing' );
|
|
assert.strictEqual( command.action, 'window' );
|
|
assert.strictEqual( command.method, 'open' );
|
|
} );
|
|
|
|
QUnit.test( 'isExecutable', ( assert ) => {
|
|
const command = new ve.ui.MWUseExistingReferenceCommand();
|
|
|
|
// XXX: This is a regression test with a fragile setup. Please feel free to delete this test
|
|
// when you feel like it doesn't make sense to update it.
|
|
const groups = {};
|
|
const fragment = {
|
|
getDocument: () => ( {
|
|
getInternalList: () => ( {
|
|
getNodeGroups: () => groups
|
|
} )
|
|
} ),
|
|
getSelection: () => ( {
|
|
getName: () => 'linear'
|
|
} )
|
|
};
|
|
assert.false( command.isExecutable( fragment ) );
|
|
|
|
groups[ 'mwReference/' ] = { indexOrder: [ 0 ] };
|
|
assert.true( command.isExecutable( fragment ) );
|
|
} );
|