mediawiki-extensions-Visual.../modules/ve-mw/tests/ui/widgets/ve.ui.MWTemplateOutlineParameterCheckboxLayout.test.js
WMDE-Fisch 407ff95597 Rename OutlineParameterCheckboxWidget to OutlineParameterCheckboxLayout
This not really just a checkbox widget anymore it inherits from
FieldLayout and became something more in that direction.

Let's use a mixture of these things to make it a bit clearer.

See also comment in Ie81b84be288553343017c4aaf8691c4e266995f5

Change-Id: Iff1746a8e5e94b56eb6c27465405aaf6b74c2310
2021-06-21 09:08:54 +02:00

28 lines
1.1 KiB
JavaScript

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