2021-03-11 10:32:30 +00:00
|
|
|
import setUserConfigFlags from '../../src/setUserConfigFlags';
|
|
|
|
|
2021-04-16 11:23:10 +00:00
|
|
|
QUnit.module( 'ext.popups#setUserConfigFlags' );
|
|
|
|
|
2021-03-11 10:32:30 +00:00
|
|
|
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' ),
|
2021-04-16 09:33:03 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviewsBetaFeature' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
|
|
|
[ true, true, true, true ]
|
|
|
|
);
|
|
|
|
|
|
|
|
config.set( 'wgPopupsFlags', '10' );
|
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
2021-04-16 09:33:03 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviewsBetaFeature' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
|
|
|
[ false, true, false, true ]
|
|
|
|
);
|
|
|
|
|
|
|
|
config.set( 'wgPopupsFlags', '5' );
|
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
2021-04-16 09:33:03 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviewsBetaFeature' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
|
|
|
[ true, false, true, false ]
|
|
|
|
);
|
|
|
|
|
|
|
|
config.set( 'wgPopupsFlags', '0' );
|
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
|
|
|
config.get( 'wgPopupsReferencePreviews' ),
|
2021-04-16 09:33:03 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviewsBetaFeature' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
|
|
|
[ false, false, false, false ]
|
|
|
|
);
|
|
|
|
} );
|