Debian Codegraph @

extensions/Cite/tests/qunit/ve-cite/ve.ui.MWUseExistingReferenceCommand.test.js

raw symbols SCIP
1 'use strict';
2
3 QUnit.module( 've.ui.MWUseExistingReferenceCommand (Cite)', ve.test.utils.newMwEnvironment() );
4
5 function getFragmentMock( hasRefs ) {
6 const docRefsMock = {
7 hasRefs: () => hasRefs
8 };
9
10 return {
11 getDocument: () => ( {
12 extCiteDocumentReferences: docRefsMock,
13 getOriginalDocument: () => undefined
14 } ),
15 getSelection: () => ( {
16 getName: () => 'linear'
17 } )
18 };
19 }
20
21 QUnit.test( 'Constructor', ( assert ) => {
22 const command = new ve.ui.MWUseExistingReferenceCommand();
23 assert.strictEqual( command.name, 'reference/existing' );
24 assert.strictEqual( command.action, 'window' );
25 assert.strictEqual( command.method, 'open' );
26 } );
27
28 QUnit.test( 'isExecutable', ( assert ) => {
29 const command = new ve.ui.MWUseExistingReferenceCommand();
30
31 assert.false( command.isExecutable( getFragmentMock( false ) ) );
32 assert.true( command.isExecutable( getFragmentMock( true ) ) );
33 } );