mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-25 05:22:57 +00:00
212dcf1d55
When opening the settings dialog, the form didn't represent the current enabled status of the application. This change makes sure that every time the form is shown, the form state represents the current application state. If the application is enabled, then the 'simple' (Enabled) option is selected on the form. If it is disabled then if there's Navigation popups, it selects 'advanced' (Advanced popups), if there are not, it selects 'off' (Disabled). Changes: * Change listeners * Set the form state every time the form is going to be shown * Update tests * Supporting changes * Add settingsDialog#setEnabled which updates the DOM form based on the enabled flag and the navpops state * Extract isNavPopupsEnabled function in settingsDialog.js to be used in the form creation and also when setting the form enabled state * Add test verifying changeListeners#settings shows and sets enabled state properly when showing the dialog more than one time Change-Id: Ic660f48d9a78e47c09a192ab86681196d2e01d61
29 lines
688 B
JavaScript
29 lines
688 B
JavaScript
( function ( $, mw ) {
|
|
QUnit.module( 'ext.popups/settingsDialog' );
|
|
|
|
QUnit.test( '#render', function ( assert ) {
|
|
var boundActions = {
|
|
saveSettings: function () {},
|
|
hideSettings: function () {}
|
|
},
|
|
expected = {
|
|
appendTo: function () {},
|
|
show: function () {},
|
|
hide: function () {},
|
|
toggleHelp: function () {},
|
|
setEnabled: function () {}
|
|
},
|
|
result = mw.popups.createSettingsDialogRenderer()( boundActions );
|
|
|
|
// Specifically NOT a deep equal. Only structure.
|
|
assert.propEqual(
|
|
result,
|
|
expected
|
|
);
|
|
} );
|
|
|
|
// FIXME: Add Qunit integration tests about the rendering and the behavior of
|
|
// the settings dialog.
|
|
|
|
} )( jQuery, mediaWiki );
|