mediawiki-extensions-Visual.../modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineParameterWidget.test.js
Thiemo Kreuz 926913cad6 Add/simplify assertions in transclusion outline related code
Bug: T289560
Change-Id: Ia76e13582a182c8184b3e8642c5c03bf3d674a24
2021-08-30 14:58:50 +00:00

29 lines
1,004 B
JavaScript

QUnit.module( 've.ui.MWTransclusionOutlineParameterWidget' );
QUnit.test( 'interprets param with no attributes', ( assert ) => {
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( {} );
assert.notOk( widget.checkbox.isDisabled() );
assert.notOk( widget.checkbox.isSelected() );
assert.strictEqual( widget.checkbox.getTitle(), null );
} );
QUnit.test( 'interprets required param', ( assert ) => {
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( { required: true } );
assert.ok( widget.checkbox.isDisabled() );
assert.ok( widget.checkbox.isSelected() );
assert.strictEqual(
widget.checkbox.getTitle(),
'visualeditor-dialog-transclusion-required-parameter'
);
} );
QUnit.test( 'interprets selected param', ( assert ) => {
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( { selected: true } );
assert.notOk( widget.checkbox.isDisabled() );
assert.ok( widget.checkbox.isSelected() );
assert.strictEqual( widget.checkbox.getTitle(), null );
} );