Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / permissions_by_term / js / test / dom-client.tests.js
1 import DomClient from "../src/client/dom-client.prototype";
2 import sinon from "sinon";
3
4 QUnit.test( "Get permission objects by querying backend with all params", async function( assert ) {
5
6   const spyReplaceWith = sinon.spy();
7
8   const document = {
9     querySelector: sinon.stub().returns({
10       replaceWith: spyReplaceWith
11     }),
12     createElement: sinon.stub().returns({innerHTML: sinon.stub()}),
13   }
14
15   const permissionsOutput = {
16     getRoles: sinon.stub().returns(['admin', 'editor']),
17     getUsernames: sinon.stub().returns(['jeff', 'brandon'])
18   }
19
20   const drupal = {
21     t: function(text) {
22       return text;
23     }
24   }
25
26   const domClient = new DomClient(document, permissionsOutput, drupal);
27   domClient.renderPermissionsInfo();
28
29   assert.deepEqual({innerHTML: '<div id="edit-permissions-by-term-info"><div class="form-type-item">This widget shows information about taxonomy term related permissions. It\'s being updated, as soon you make any related changes in the form.<br /><br /><b>Allowed users:</b> jeff, brandon<br /><b>Allowed roles:</b> admin, editor</div></div>'}, spyReplaceWith.getCall(0).args[0]);
30
31 });