Files
zulip/frontend_tests/node_tests/support.js
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00

25 lines
678 B
JavaScript

"use strict";
const fs = require("fs");
const {JSDOM} = require("jsdom");
const template = fs.readFileSync("templates/analytics/realm_details.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document;
let jquery_init;
global.$ = (f) => {
jquery_init = f;
};
zrequire("support", "js/analytics/support");
set_global("$", global.make_zjquery());
run_test("scrub_realm", () => {
jquery_init();
const click_handler = $("body").get_on_handler("click", ".scrub-realm-button");
assert.equal(typeof click_handler, "function");
assert.equal(document.querySelectorAll(".scrub-realm-button").length, 1);
});