mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-12 07:45:15 +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
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
import setUserConfigFlags from '../../src/setUserConfigFlags';
|
|
|
|
QUnit.module( 'ext.popups#setUserConfigFlags' );
|
|
|
|
QUnit.test( 'config settings are successfully set from bitmask', ( assert ) => {
|
|
const config = new Map();
|
|
|
|
config.set( 'wgPopupsFlags', '15' );
|
|
setUserConfigFlags( config );
|
|
|
|
assert.deepEqual(
|
|
[
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
|
config.get( 'wgPopupsReferencePreviewsBeta' )
|
|
],
|
|
[ true, true, true, true ]
|
|
);
|
|
|
|
config.set( 'wgPopupsFlags', '10' );
|
|
setUserConfigFlags( config );
|
|
|
|
assert.deepEqual(
|
|
[
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
|
config.get( 'wgPopupsReferencePreviewsBeta' )
|
|
],
|
|
[ false, true, false, true ]
|
|
);
|
|
|
|
config.set( 'wgPopupsFlags', '5' );
|
|
setUserConfigFlags( config );
|
|
|
|
assert.deepEqual(
|
|
[
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
|
config.get( 'wgPopupsReferencePreviewsBeta' )
|
|
],
|
|
[ true, false, true, false ]
|
|
);
|
|
|
|
config.set( 'wgPopupsFlags', '0' );
|
|
setUserConfigFlags( config );
|
|
|
|
assert.deepEqual(
|
|
[
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
|
config.get( 'wgPopupsReferencePreviewsBeta' )
|
|
],
|
|
[ false, false, false, false ]
|
|
);
|
|
} );
|