mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 10:59:56 +00:00
407ff95597
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
28 lines
1.1 KiB
JavaScript
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 );
|
|
} );
|
|
}() );
|