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() {
|
2018-12-13 03:09:26 +00:00
|
|
|
function render() {
|
|
|
|
return $( '<div>' );
|
|
|
|
}
|
|
|
|
function getTemplate() {
|
|
|
|
return { render };
|
|
|
|
}
|
2017-02-22 10:22:58 +00:00
|
|
|
|
2018-07-06 15:41:19 +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-19 19:39:41 +00:00
|
|
|
const 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.
|