mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-25 07:56:40 +00:00
ae44042cbf
Change-Id: Ic0a47bd468532824e8648c3f6371cc403896603c
47 lines
1 KiB
JavaScript
47 lines
1 KiB
JavaScript
import createMwPopups from '../../../src/integrations/mwpopups';
|
|
|
|
/**
|
|
* @private
|
|
* @param {*} state
|
|
* @return {Object}
|
|
*/
|
|
function mockStore( state ) {
|
|
return {
|
|
getState() {
|
|
return state;
|
|
}
|
|
};
|
|
}
|
|
|
|
QUnit.module( 'ext.popups/integrations' );
|
|
|
|
QUnit.test( '#isEnabled returns correct value when disabled', function ( assert ) {
|
|
const state = {
|
|
preview: {
|
|
enabled: false
|
|
}
|
|
},
|
|
store = mockStore( state ),
|
|
popups = createMwPopups( store );
|
|
|
|
this.sandbox.spy( store, 'getState' );
|
|
|
|
assert.equal( popups.isEnabled(), false, 'Popups are disabled.' );
|
|
assert.strictEqual( store.getState.callCount, 1, 'The store was checked.' );
|
|
} );
|
|
|
|
QUnit.test( '#isEnabled returns correct value when enabled', function ( assert ) {
|
|
const state = {
|
|
preview: {
|
|
enabled: true
|
|
}
|
|
},
|
|
store = mockStore( state ),
|
|
popups = createMwPopups( store );
|
|
|
|
this.sandbox.spy( store, 'getState' );
|
|
|
|
assert.equal( popups.isEnabled(), true, 'Popups are enabled.' );
|
|
assert.strictEqual( store.getState.callCount, 1, 'The store was checked.' );
|
|
} );
|