2018-03-08 20:57:22 +00:00
|
|
|
import createSettingsDialogRenderer from '../../../src/ui/settingsDialogRenderer';
|
2017-02-22 10:22:58 +00:00
|
|
|
|
2018-03-08 20:57:22 +00:00
|
|
|
QUnit.module( 'ext.popups/settingsDialogRenderer', {
|
2018-03-14 22:04:59 +00:00
|
|
|
beforeEach() {
|
2017-02-22 10:22:58 +00:00
|
|
|
function render() { return $( '<div>' ); }
|
2018-03-14 19:44:22 +00:00
|
|
|
function getTemplate() { return { render }; }
|
2017-02-22 10:22:58 +00:00
|
|
|
|
2018-03-13 22:03:49 +00:00
|
|
|
mediaWiki.html = { escape: str => str };
|
2017-02-22 10:22:58 +00:00
|
|
|
mediaWiki.template = { get: getTemplate };
|
2018-03-14 22:04:59 +00:00
|
|
|
mediaWiki.config = { get() {} };
|
2018-03-14 23:50:09 +00:00
|
|
|
mediaWiki.msg = () => {};
|
2017-02-22 10:22:58 +00:00
|
|
|
},
|
2018-03-14 22:04:59 +00:00
|
|
|
afterEach() {
|
2018-03-13 22:03:49 +00:00
|
|
|
mediaWiki.msg = null;
|
2017-02-22 10:22:58 +00:00
|
|
|
mediaWiki.config = null;
|
|
|
|
mediaWiki.template = null;
|
2018-03-13 22:03:49 +00:00
|
|
|
mediaWiki.html = null;
|
2017-02-22 10:22:58 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2018-03-14 23:50:09 +00:00
|
|
|
QUnit.test( '#render', ( assert ) => {
|
2018-03-15 16:30:11 +00:00
|
|
|
let boundActions = {
|
2018-03-14 22:04:59 +00:00
|
|
|
saveSettings() {},
|
|
|
|
hideSettings() {}
|
2017-02-22 10:22:58 +00:00
|
|
|
},
|
|
|
|
expected = {
|
2018-03-14 22:04:59 +00:00
|
|
|
appendTo() {},
|
|
|
|
show() {},
|
|
|
|
hide() {},
|
|
|
|
toggleHelp() {},
|
|
|
|
setEnabled() {}
|
2017-02-22 10:22:58 +00:00
|
|
|
},
|
|
|
|
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.
|