mediawiki-extensions-Popups/tests/node-qunit/setUserConfigFlags.test.js
WMDE-Fisch b218a77ca4 Remove all BetaFeature code from ReferencePreviews
The extension is out of beta and will be enabled by default now.
Leaving some hints if we decide to also remove the feature flag.

Bug: T282999
Bug: T351708
Change-Id: I1556b2f3592294d094770ede2c276eddeef8bbe9
2023-11-24 13:07:46 +01:00

56 lines
1.3 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', '7' );
setUserConfigFlags( config );
assert.deepEqual(
[
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
config.get( 'wgPopupsReferencePreviews' )
],
[ true, true, true ]
);
config.set( 'wgPopupsFlags', '2' );
setUserConfigFlags( config );
assert.deepEqual(
[
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
config.get( 'wgPopupsReferencePreviews' )
],
[ false, true, false ]
);
config.set( 'wgPopupsFlags', '5' );
setUserConfigFlags( config );
assert.deepEqual(
[
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
config.get( 'wgPopupsReferencePreviews' )
],
[ true, false, true ]
);
config.set( 'wgPopupsFlags', '0' );
setUserConfigFlags( config );
assert.deepEqual(
[
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
config.get( 'wgPopupsReferencePreviews' )
],
[ false, false, false ]
);
} );