mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-18 18:20:51 +00:00
76e02fae98
Notice how this actually reduces the size of the final, compiled index.js. It's not much, but still. One issue I noticed is that the coverage reports for the JS code stopped working. I have no idea why. Bug: T208951 Change-Id: I2fe92579574b3b1ba4d2dd064899eee944045a96
49 lines
1,016 B
JavaScript
49 lines
1,016 B
JavaScript
import createSettingsDialogRenderer from '../../../src/ui/settingsDialogRenderer';
|
|
|
|
QUnit.module( 'ext.popups/settingsDialogRenderer', {
|
|
beforeEach() {
|
|
function render() {
|
|
return $( '<div>' );
|
|
}
|
|
function getTemplate() {
|
|
return { render };
|
|
}
|
|
|
|
mw.html = { escape: ( str ) => str };
|
|
mw.template = { get: getTemplate };
|
|
mw.config = { get() {} };
|
|
mw.msg = () => {};
|
|
},
|
|
afterEach() {
|
|
mw.msg = null;
|
|
mw.config = null;
|
|
mw.template = null;
|
|
mw.html = null;
|
|
}
|
|
} );
|
|
|
|
QUnit.test( '#render', ( assert ) => {
|
|
const 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.
|