mediawiki-extensions-Visual.../modules/ve-mw/tests/ui/widgets/ve.ui.MWTemplateOutlineParameterCheckboxWidget.test.js
Adam Wight 988cda65dd Template dialog checkbox list
Introduces new widgets forming the backbone of the experimental
template dialog sidebar.

FIXME: `text-overflow: ellipsis` is not working yet, the container
styles need adjustment.

Bug: T274543
Change-Id: Ie81b84be288553343017c4aaf8691c4e266995f5
2021-06-17 08:47:47 +00:00

28 lines
1.1 KiB
JavaScript

( function () {
QUnit.module( 've.ui.MWTemplateOutlineParameterCheckboxWidget', ve.test.utils.mwEnvironment );
QUnit.test( 'interprets param with no attributes', ( assert ) => {
const widget = new ve.ui.MWTemplateOutlineParameterCheckboxWidget( {} );
assert.strictEqual( widget.fieldWidget.disabled, false );
assert.strictEqual( widget.fieldWidget.selected, false );
assert.strictEqual( widget.fieldWidget.title, null );
} );
QUnit.test( 'interprets required param', ( assert ) => {
const widget = new ve.ui.MWTemplateOutlineParameterCheckboxWidget( { required: true } );
assert.strictEqual( widget.fieldWidget.disabled, true );
assert.strictEqual( widget.fieldWidget.selected, true );
assert.notStrictEqual( widget.fieldWidget.title, null );
} );
QUnit.test( 'interprets included param', ( assert ) => {
const widget = new ve.ui.MWTemplateOutlineParameterCheckboxWidget( { selected: true } );
assert.strictEqual( widget.fieldWidget.disabled, false );
assert.strictEqual( widget.fieldWidget.selected, true );
assert.strictEqual( widget.fieldWidget.title, null );
} );
}() );