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();
|
|
|
|
|
2023-11-06 08:48:29 +00:00
|
|
|
config.set( 'wgPopupsFlags', '7' );
|
2021-03-11 10:32:30 +00:00
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
2023-11-06 08:48:29 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviews' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
2023-11-06 08:48:29 +00:00
|
|
|
[ true, true, true ]
|
2021-03-11 10:32:30 +00:00
|
|
|
);
|
|
|
|
|
2023-11-06 08:48:29 +00:00
|
|
|
config.set( 'wgPopupsFlags', '2' );
|
2021-03-11 10:32:30 +00:00
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
2023-11-06 08:48:29 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviews' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
2023-11-06 08:48:29 +00:00
|
|
|
[ false, true, false ]
|
2021-03-11 10:32:30 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
config.set( 'wgPopupsFlags', '5' );
|
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
2023-11-06 08:48:29 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviews' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
2023-11-06 08:48:29 +00:00
|
|
|
[ true, false, true ]
|
2021-03-11 10:32:30 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
config.set( 'wgPopupsFlags', '0' );
|
|
|
|
setUserConfigFlags( config );
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
config.get( 'wgPopupsConflictsWithNavPopupGadget' ),
|
|
|
|
config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ),
|
2023-11-06 08:48:29 +00:00
|
|
|
config.get( 'wgPopupsReferencePreviews' )
|
2021-03-11 10:32:30 +00:00
|
|
|
],
|
2023-11-06 08:48:29 +00:00
|
|
|
[ false, false, false ]
|
2021-03-11 10:32:30 +00:00
|
|
|
);
|
|
|
|
} );
|