2021-08-24 09:31:14 +00:00
|
|
|
QUnit.module( 've.ui.MWTransclusionOutlinePlaceholderWidget' );
|
|
|
|
|
|
|
|
QUnit.test( 'Constructor', ( assert ) => {
|
|
|
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
2022-05-04 10:00:47 +00:00
|
|
|
placeholder = new ve.dm.MWTemplatePlaceholderModel( transclusion );
|
|
|
|
let widget = new ve.ui.MWTransclusionOutlinePlaceholderWidget( placeholder );
|
2021-08-24 09:31:14 +00:00
|
|
|
|
2021-08-24 11:17:16 +00:00
|
|
|
assert.strictEqual( widget.getData(), 'part_0' );
|
|
|
|
assert.strictEqual(
|
|
|
|
widget.$element.find( '.ve-ui-mwTransclusionOutlineButtonWidget' ).text(),
|
2022-05-04 10:00:47 +00:00
|
|
|
'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'
|
2021-08-24 11:17:16 +00:00
|
|
|
);
|
2021-08-24 09:31:14 +00:00
|
|
|
} );
|