mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-11 14:46:11 +00:00
ab0f2ea000
Bug: T370875 Change-Id: I6ed43ea3a5b25c2ef5afc373b5a2523a730fd11e
34 lines
894 B
JavaScript
34 lines
894 B
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWUseExistingReferenceCommand (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
function getFragementMock( hasRefs ) {
|
|
const docRefsMock = {
|
|
hasRefs: () => hasRefs
|
|
};
|
|
|
|
return {
|
|
getDocument: () => ( {
|
|
getOriginalDocument: () => undefined,
|
|
getStorage: () => docRefsMock
|
|
} ),
|
|
getSelection: () => ( {
|
|
getName: () => 'linear'
|
|
} )
|
|
};
|
|
}
|
|
|
|
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();
|
|
|
|
assert.false( command.isExecutable( getFragementMock( false ) ) );
|
|
assert.true( command.isExecutable( getFragementMock( true ) ) );
|
|
} );
|