2020-08-01 03:43:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
2019-04-19 18:17:41 +02:00
|
|
|
const fs = require("fs");
|
2020-07-24 06:02:07 +02:00
|
|
|
|
2020-07-16 22:40:18 +02:00
|
|
|
const {JSDOM} = require("jsdom");
|
2020-07-24 06:02:07 +02:00
|
|
|
|
2019-09-11 13:40:45 +02:00
|
|
|
const template = fs.readFileSync("templates/analytics/realm_details.html", "utf-8");
|
2020-07-16 22:40:18 +02:00
|
|
|
const dom = new JSDOM(template, {pretendToBeVisual: true});
|
2019-04-19 18:17:41 +02:00
|
|
|
const document = dom.window.document;
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
let jquery_init;
|
2020-07-15 00:34:28 +02:00
|
|
|
global.$ = (f) => {
|
|
|
|
jquery_init = f;
|
|
|
|
};
|
2020-07-15 01:29:15 +02:00
|
|
|
zrequire("support", "js/analytics/support");
|
|
|
|
set_global("$", global.make_zjquery());
|
2019-04-19 18:17:41 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
run_test("scrub_realm", () => {
|
2019-04-19 18:17:41 +02:00
|
|
|
jquery_init();
|
2020-07-15 01:29:15 +02:00
|
|
|
const click_handler = $("body").get_on_handler("click", ".scrub-realm-button");
|
|
|
|
assert.equal(typeof click_handler, "function");
|
2019-04-19 18:17:41 +02:00
|
|
|
|
2019-09-11 13:40:45 +02:00
|
|
|
assert.equal(document.querySelectorAll(".scrub-realm-button").length, 1);
|
2019-04-19 18:17:41 +02:00
|
|
|
});
|