mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-11 22:16:15 +00:00
9297428eca
This focuses on some scenarios that are a) complex enough to be worth a test, b) but simple enough so I don't need to spend hours on comming up with a test setup. ;-) This patch also simplifies the ARIA related code in MWTransclusionOutlinePartWidget a bit. * Check 1 of the 3 ARIA configs only. Only having one is already helpful and should not be skipped. * No need for the large conditional. setAriaDescribedBy() works fine with undefined. Bug: T291157 Change-Id: I142782ec9b96147de64497f4f6a373eae05b9c8e
21 lines
620 B
JavaScript
21 lines
620 B
JavaScript
QUnit.module( 've.ui.MWTransclusionOutlineButtonWidget' );
|
|
|
|
QUnit.test( 'Constructor', ( assert ) => {
|
|
const widget = new ve.ui.MWTransclusionOutlineButtonWidget( {} );
|
|
|
|
// eslint-disable-next-line no-jquery/no-class-state
|
|
assert.true( widget.$element.hasClass( 've-ui-mwTransclusionOutlineButtonWidget' ) );
|
|
} );
|
|
|
|
QUnit.test( 'onKeyDown', ( assert ) => {
|
|
const done = assert.async(),
|
|
widget = new ve.ui.MWTransclusionOutlineButtonWidget( {} ),
|
|
event = $.Event( 'keydown', { which: 32 } );
|
|
|
|
widget.on( 'keyPressed', ( key ) => {
|
|
assert.strictEqual( key, 32 );
|
|
done();
|
|
} );
|
|
widget.onKeyDown( event );
|
|
} );
|