mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 19:50:04 +00:00
ece4670710
In some places, the arrow function seems more natural. This patch approximates the following with manual amendments: 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%function\s*(\([^)]*\))%\1 =>%g' Files to focus on were identified with: rg -slg\!/resources/dist/ -g\!/i18n/ -g\!/doc/ 'this|self|arguments|bind|call|apply|new'| xargs -rd\\n git difftool -y Bug: T165036 Change-Id: Ic66b6000b8fc000f9bfde39749f9cfa69924a13c
45 lines
1 KiB
JavaScript
45 lines
1 KiB
JavaScript
import createSettingsDialogRenderer from '../../../src/ui/settingsDialogRenderer';
|
|
|
|
QUnit.module( 'ext.popups/settingsDialogRenderer', {
|
|
beforeEach() {
|
|
function render() { return $( '<div>' ); }
|
|
function getTemplate() { return { render }; }
|
|
|
|
mediaWiki.html = { escape: str => str };
|
|
mediaWiki.template = { get: getTemplate };
|
|
mediaWiki.config = { get() {} };
|
|
mediaWiki.msg = () => {};
|
|
},
|
|
afterEach() {
|
|
mediaWiki.msg = null;
|
|
mediaWiki.config = null;
|
|
mediaWiki.template = null;
|
|
mediaWiki.html = null;
|
|
}
|
|
} );
|
|
|
|
QUnit.test( '#render', ( assert ) => {
|
|
var boundActions = {
|
|
saveSettings() {},
|
|
hideSettings() {}
|
|
},
|
|
expected = {
|
|
appendTo() {},
|
|
show() {},
|
|
hide() {},
|
|
toggleHelp() {},
|
|
setEnabled() {}
|
|
},
|
|
result = createSettingsDialogRenderer()( boundActions );
|
|
|
|
// Specifically NOT a deep equal. Only structure.
|
|
assert.propEqual(
|
|
result,
|
|
expected,
|
|
'Interface exposed has the expected methods'
|
|
);
|
|
} );
|
|
|
|
// FIXME: Add Qunit integration tests about the rendering and the behavior of
|
|
// the settings dialog.
|