mediawiki-extensions-Visual.../modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineParameterWidget.test.js
Thiemo Kreuz 1f19d85ea8 More test cases for more complex template dialog functionality
Contains:
* Full test coverage (I believe) for the filter functionality in
  …OutlineTemplateWidget.

Also some TODOs for missing tests I believe are critical.

Bug: T289560
Change-Id: I2ac5add8e189d501d3558bbd4854cb92155bcb96
2021-08-28 14:02:57 +02:00

29 lines
1.1 KiB
JavaScript

QUnit.module( 've.ui.MWTransclusionOutlineParameterWidget' );
QUnit.test( 'interprets param with no attributes', ( assert ) => {
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( {} );
assert.strictEqual( widget.checkbox.isDisabled(), false );
assert.strictEqual( widget.checkbox.isSelected(), false );
assert.strictEqual( widget.checkbox.getTitle(), null );
} );
QUnit.test( 'interprets required param', ( assert ) => {
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( { required: true } );
assert.strictEqual( widget.checkbox.isDisabled(), true );
assert.strictEqual( widget.checkbox.isSelected(), true );
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.strictEqual( widget.checkbox.isDisabled(), false );
assert.strictEqual( widget.checkbox.isSelected(), true );
assert.strictEqual( widget.checkbox.getTitle(), null );
} );