mediawiki-extensions-Popups/tests/node-qunit/ui/settingsDialogRenderer.test.js
jdlrobson 10e6e25091 Upgrade eslint-config-wikimedia
* Force arrow-parens
* Disable no-prototype-builtins for time being
* Drop unnecessary maxlen rule

Change-Id: Iceb0fe47354a5753202d2c6ad9e1a9c76791f744
2018-07-13 07:42:12 -05:00

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 ) => {
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.