mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
More assertions for ve.ui.MWTransclusionOutlineParameterWidget
These additional assertions cover previously uncovered features. Change-Id: I6708ce2ef965f9ad81ec3d0aee163b6f2093344c
This commit is contained in:
parent
3f97610e6e
commit
f14eba17ee
|
@ -3,26 +3,41 @@ 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.isSelected() );
|
||||
assert.notOk( widget.checkbox.isSelected() );
|
||||
assert.notOk( widget.checkbox.isDisabled() );
|
||||
assert.strictEqual( widget.checkbox.getTitle(), null );
|
||||
|
||||
widget.setSelected( true );
|
||||
assert.ok( widget.isSelected(), 'can select item' );
|
||||
assert.ok( widget.checkbox.isSelected(), 'can select checkbox' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'interprets required param', ( assert ) => {
|
||||
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( { required: true } );
|
||||
|
||||
assert.ok( widget.checkbox.isDisabled() );
|
||||
assert.ok( widget.isSelected() );
|
||||
assert.ok( widget.checkbox.isSelected() );
|
||||
assert.ok( widget.checkbox.isDisabled() );
|
||||
assert.strictEqual(
|
||||
widget.checkbox.getTitle(),
|
||||
'visualeditor-dialog-transclusion-required-parameter'
|
||||
);
|
||||
|
||||
widget.setSelected( false );
|
||||
assert.ok( widget.isSelected(), 'cannot unselect required item' );
|
||||
assert.ok( widget.checkbox.isSelected(), 'cannot unselect required checkbox' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'interprets selected param', ( assert ) => {
|
||||
const widget = new ve.ui.MWTransclusionOutlineParameterWidget( { selected: true } );
|
||||
|
||||
assert.notOk( widget.checkbox.isDisabled() );
|
||||
assert.ok( widget.isSelected() );
|
||||
assert.ok( widget.checkbox.isSelected() );
|
||||
assert.notOk( widget.checkbox.isDisabled() );
|
||||
assert.strictEqual( widget.checkbox.getTitle(), null );
|
||||
|
||||
widget.setSelected( false );
|
||||
assert.notOk( widget.isSelected(), 'can unselect item' );
|
||||
assert.notOk( widget.checkbox.isSelected(), 'can unselect checkbox' );
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue