mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-12 15:15:12 +00:00
2ffbf1fa66
MVP implementation for adding a warning when editing a reference that's the extension of another. In the current approach we're just using the elements .text() like we do when you create an extended reference. Bug: T247922 Change-Id: I2fc574152059937b4aa3fc25ee486d363cc809d5
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWReferenceDialog (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'setReferenceForEditing', ( assert ) => {
|
|
const dialog = new ve.ui.MWReferenceDialog();
|
|
|
|
dialog.referenceGroupInput = new ve.ui.MWReferenceGroupInputWidget( {} );
|
|
dialog.reuseWarning = new OO.ui.MessageWidget();
|
|
dialog.extendsWarning = new OO.ui.MessageWidget();
|
|
|
|
// 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.
|
|
dialog.referenceTarget = {
|
|
setDocument: () => null
|
|
};
|
|
dialog.fragment = {
|
|
getDocument: () => ( {
|
|
getInternalList: () => ( {
|
|
getNodeGroup: () => null
|
|
} )
|
|
} )
|
|
};
|
|
|
|
const parentDoc = {
|
|
cloneWithData: () => null
|
|
};
|
|
const ref = new ve.dm.MWReferenceModel( parentDoc );
|
|
ref.setGroup( 'g' );
|
|
dialog.setReferenceForEditing( ref );
|
|
|
|
assert.strictEqual( dialog.referenceModel, ref );
|
|
assert.strictEqual( dialog.originalGroup, 'g' );
|
|
assert.strictEqual( dialog.referenceGroupInput.getValue(), 'g' );
|
|
assert.false( dialog.referenceGroupInput.isDisabled() );
|
|
assert.false( dialog.reuseWarning.isVisible() );
|
|
} );
|