mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-11 15:27:04 +00:00
fcfe079d79
Reducer changes: * Break the mw.popups.reducers.rootReducer test into @@INIT tests for each reducer as there's shouldn't be any need to test that a framework works as documented. Changes: * Move the mw.popups.reducers#preview, #eventLogging, and #settings reducers into their own files in resources/ext.popups/reducers/. * Make the associated tests mirror the new layout. * Move the initialization of the mw.popups.reducers namespace into its own file. * Remove the mw.popups.rootReducer property in favour of a simple private factory function per the reducer change above. Change-Id: I94229d9ef1985f3806eec44c2e8234a5bbddc94f
41 lines
819 B
JavaScript
41 lines
819 B
JavaScript
( function ( mw ) {
|
|
|
|
QUnit.module( 'ext.popups/reducers#settings' );
|
|
|
|
QUnit.test( '@@INIT', function ( assert ) {
|
|
var state = mw.popups.reducers.settings( undefined, { type: '@@INIT' } );
|
|
|
|
assert.deepEqual(
|
|
state,
|
|
{
|
|
shouldShow: false
|
|
}
|
|
);
|
|
} );
|
|
|
|
QUnit.test( 'SETTINGS_SHOW', function ( assert ) {
|
|
assert.expect( 1 );
|
|
|
|
assert.deepEqual(
|
|
mw.popups.reducers.settings( {}, { type: 'SETTINGS_SHOW' } ),
|
|
{
|
|
shouldShow: true
|
|
},
|
|
'It should mark the settings dialog as ready to be shown.'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( 'SETTINGS_HIDE', function ( assert ) {
|
|
assert.expect( 1 );
|
|
|
|
assert.deepEqual(
|
|
mw.popups.reducers.settings( {}, { type: 'SETTINGS_HIDE' } ),
|
|
{
|
|
shouldShow: false
|
|
},
|
|
'It should mark the settings dialog as ready to be closed.'
|
|
);
|
|
} );
|
|
|
|
}( mediaWiki ) );
|