mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-18 17:50:43 +00:00
d6a58cfa8d
Note these are more meant as regression test to better cover what's done in other patches. Everybody should feel free to delete a test when it gets in the way. I marked a few especially fragile places with respective comments. Bug: T358652 Change-Id: I7844907fe3ef4f3439717381b4ecdac9e2d0a825
33 lines
1,008 B
JavaScript
33 lines
1,008 B
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWUseExistingReferenceCommand (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'Constructor', function ( 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', function ( 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 ) );
|
|
} );
|