mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-13 08:08:39 +00:00
3466e66995
* That `this.user` is unused. * Some tests missed a module name. This means they are reported as part of the previous module. While this is purely cosmetic, it's confusing to see the wrong module name in the report. Change-Id: I73915d3c4fd9a03bda1ddc8dff6dd5539113c3cd
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import isReferencePreviewsEnabled from '../../src/isReferencePreviewsEnabled';
|
|
|
|
QUnit.module( 'ext.popups#isReferencePreviewsEnabled' );
|
|
|
|
QUnit.test( 'it should display reference previews when conditions are fulfilled', ( assert ) => {
|
|
const config = new Map();
|
|
|
|
config.set( 'wgPopupsReferencePreviews', true );
|
|
config.set( 'wgPopupsConflictsWithRefTooltipsGadget', false );
|
|
|
|
assert.ok(
|
|
isReferencePreviewsEnabled( config ),
|
|
'If the user is logged in and the user is in the on group, then it\'s enabled.'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( 'it should handle the conflict with the Reference Tooltips Gadget', ( assert ) => {
|
|
const config = new Map();
|
|
|
|
config.set( 'wgPopupsReferencePreviews', true );
|
|
config.set( 'wgPopupsConflictsWithRefTooltipsGadget', true );
|
|
|
|
assert.notOk(
|
|
isReferencePreviewsEnabled( config ),
|
|
'Reference Previews is disabled.'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( 'it should not be enabled when the global is disabling it', ( assert ) => {
|
|
const config = new Map();
|
|
|
|
config.set( 'wgPopupsReferencePreviews', false );
|
|
config.set( 'wgPopupsConflictsWithRefTooltipsGadget', false );
|
|
|
|
assert.notOk(
|
|
isReferencePreviewsEnabled( config ),
|
|
'Reference Previews is disabled.'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( 'it should not be enabled when minerva skin used', ( assert ) => {
|
|
const config = new Map();
|
|
|
|
config.set( 'wgPopupsReferencePreviews', true );
|
|
config.set( 'wgPopupsConflictsWithRefTooltipsGadget', false );
|
|
config.set( 'skin', 'minerva' );
|
|
|
|
assert.notOk(
|
|
isReferencePreviewsEnabled( config ),
|
|
'Reference Previews is disabled.'
|
|
);
|
|
} );
|