mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Increase test coverage
More of a random thing done to increase the coverage a bit because there are upcomming features that seem to be hard to test. - Found one test case in reference previews that was configured wrongly - Adding some sanity checks to the settingsDialogRender test Change-Id: I95d3c6f30388b2dcc76b018d5dc0f958d06aad91
This commit is contained in:
parent
381f8f5f7d
commit
e15e2c4d14
|
@ -109,7 +109,7 @@ QUnit.test( 'all relevant combinations of flags', ( assert ) => {
|
|||
// TODO: This combination will make much more sense when the server-side
|
||||
// wgPopupsReferencePreviews flag doesn't include the user's setting any more
|
||||
testCase: 'manually disabled by the registered user',
|
||||
wgPopupsReferencePreviews: false,
|
||||
wgPopupsReferencePreviews: true,
|
||||
wgPopupsConflictsWithRefTooltipsGadget: false,
|
||||
isMobile: false,
|
||||
isAnon: false,
|
||||
|
|
|
@ -38,6 +38,7 @@ QUnit.test( '#toggleHelp', ( assert ) => {
|
|||
} );
|
||||
|
||||
QUnit.test( '#render', ( assert ) => {
|
||||
const main = document.createElement( 'main' );
|
||||
const boundActions = {
|
||||
saveSettings() {},
|
||||
hideSettings() {}
|
||||
|
@ -50,14 +51,23 @@ QUnit.test( '#render', ( assert ) => {
|
|||
toggleHelp() {},
|
||||
setEnabled() {}
|
||||
},
|
||||
result = createSettingsDialogRenderer( mw.config )( boundActions, {} );
|
||||
dialogRenderer = createSettingsDialogRenderer( mw.config )( boundActions, {} );
|
||||
|
||||
// Specifically NOT a deep equal. Only structure.
|
||||
assert.propEqual(
|
||||
result,
|
||||
dialogRenderer,
|
||||
expected,
|
||||
'Interface exposed has the expected methods'
|
||||
);
|
||||
|
||||
// Sanity checks for some methods
|
||||
assert.strictEqual( main.childElementCount, 0 );
|
||||
dialogRenderer.appendTo( main );
|
||||
assert.strictEqual( main.childElementCount, 1 );
|
||||
|
||||
assert.strictEqual( $( main.children[ 0 ] ).css( 'display' ), 'block' );
|
||||
dialogRenderer.hide();
|
||||
assert.strictEqual( $( main.children[ 0 ] ).css( 'display' ), 'none' );
|
||||
} );
|
||||
|
||||
// FIXME: Add Qunit integration tests about the rendering and the behavior of
|
||||
|
|
Loading…
Reference in a new issue