mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-17 20:41:32 +00:00
a67466acc0
Replace easily identifiable object functions with method syntax: find \ -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \ -iname \*.js| xargs -rd\\n sed -ri 's%:\s*function\s*(\([^)]*\))%\1%g' Bug: T165036 Change-Id: I90693ee99a6a36dff820dd5ae6f6000429763058
47 lines
931 B
JavaScript
47 lines
931 B
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 ) {
|
|
var state = {
|
|
preview: {
|
|
enabled: false
|
|
}
|
|
},
|
|
store = mockStore( state ),
|
|
popups = createMwPopups( store );
|
|
|
|
this.sandbox.spy( store, 'getState' );
|
|
|
|
assert.equal( popups.isEnabled(), false );
|
|
assert.ok( store.getState.calledOnce );
|
|
} );
|
|
|
|
QUnit.test( '#isEnabled returns correct value when enabled', function ( assert ) {
|
|
var state = {
|
|
preview: {
|
|
enabled: true
|
|
}
|
|
},
|
|
store = mockStore( state ),
|
|
popups = createMwPopups( store );
|
|
|
|
this.sandbox.spy( store, 'getState' );
|
|
|
|
assert.equal( popups.isEnabled(), true );
|
|
assert.ok( store.getState.calledOnce );
|
|
} );
|