mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-04 03:18:19 +00:00
8b60ead109
Mainly leaving out the event handling for the change detection to still keep it simple. Also the data flow back for editing the content is still somewhat opaque because the relevant data is passed by reference. I might change that in follow up patches so it's more clear. Bug: T369005 Change-Id: I93b62791ef10bf318697905af8a0c5b5d438fdb5
27 lines
937 B
JavaScript
27 lines
937 B
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.ui.MWReferenceEditPanel (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'setReferenceForEditing', ( assert ) => {
|
|
ve.init.target.surface = { commandRegistry: { registry: {} } };
|
|
const editPanel = new ve.ui.MWReferenceEditPanel();
|
|
|
|
const emptyDoc = new ve.dm.Document( [
|
|
{ type: 'paragraph', internal: { generated: 'empty' } },
|
|
{ type: '/paragraph' },
|
|
{ type: 'internalList' },
|
|
{ type: '/internalList' }
|
|
] );
|
|
const ref = new ve.dm.MWReferenceModel( emptyDoc );
|
|
|
|
editPanel.setInternalList( emptyDoc.getInternalList() );
|
|
ref.setGroup( 'g' );
|
|
editPanel.setReferenceForEditing( ref );
|
|
|
|
assert.strictEqual( editPanel.originalGroup, 'g' );
|
|
assert.strictEqual( editPanel.referenceGroupInput.getValue(), 'g' );
|
|
assert.false( editPanel.referenceGroupInput.isDisabled() );
|
|
assert.false( editPanel.reuseWarning.isVisible() );
|
|
assert.false( editPanel.extendsWarning.isVisible() );
|
|
} );
|