mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-18 18:20:51 +00:00
abc2026890
Via jscodeshift: jscodeshift \ -t jscodeshift-recipes/src/qunit-assert-equal-to-strictEqual.js \ Popups/tests Also, some very minor manual clean up. https://github.com/niedzielski/jscodeshift-recipes/blob/5944e50/src/qunit-assert-equal-to-strictEqual.js Additional change: * Drop redundant clipPath parameter from createThumbnailElement - this parameter does not exist in the function signature. Change-Id: I209ecf2d54b6f5c17767aa2041d8f11cb368a9b5
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.strictEqual( 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.strictEqual( popups.isEnabled(), true, 'Popups are enabled.' );
|
|
assert.strictEqual( store.getState.callCount, 1, 'The store was checked.' );
|
|
} );
|