mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-22 19:12:50 +00:00
9297428eca
This focuses on some scenarios that are a) complex enough to be worth a test, b) but simple enough so I don't need to spend hours on comming up with a test setup. ;-) This patch also simplifies the ARIA related code in MWTransclusionOutlinePartWidget a bit. * Check 1 of the 3 ARIA configs only. Only having one is already helpful and should not be skipped. * No need for the large conditional. setAriaDescribedBy() works fine with undefined. Bug: T291157 Change-Id: I142782ec9b96147de64497f4f6a373eae05b9c8e
25 lines
990 B
JavaScript
25 lines
990 B
JavaScript
QUnit.module( 've.ui.MWTransclusionOutlinePlaceholderWidget' );
|
|
|
|
QUnit.test( 'Constructor', ( assert ) => {
|
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
|
placeholder = new ve.dm.MWTemplatePlaceholderModel( transclusion );
|
|
let widget = new ve.ui.MWTransclusionOutlinePlaceholderWidget( placeholder );
|
|
|
|
assert.strictEqual( widget.getData(), 'part_0' );
|
|
assert.strictEqual(
|
|
widget.$element.find( '.ve-ui-mwTransclusionOutlineButtonWidget' ).text(),
|
|
'visualeditor-dialog-transclusion-add-template',
|
|
'Outline item says "Add template" by default'
|
|
);
|
|
|
|
// Bypass the asynchronous .addPart() and the API request it does
|
|
transclusion.parts.push( placeholder );
|
|
widget = new ve.ui.MWTransclusionOutlinePlaceholderWidget( placeholder );
|
|
|
|
assert.strictEqual(
|
|
widget.$element.find( '.ve-ui-mwTransclusionOutlineButtonWidget' ).text(),
|
|
'visualeditor-dialog-transclusion-template-search',
|
|
'Outline item says "Template search" when this placeholder is the only part'
|
|
);
|
|
} );
|