Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

node tests: Improve copy_data_attribute_value test.

Steve Howella532c643c556
diff --git a/frontend_tests/node_tests/common.js b/frontend_tests/node_tests/common.js
index 75f6ee6ec31..adf8d262262 100644
--- a/frontend_tests/node_tests/common.js
+++ b/frontend_tests/node_tests/common.js
@@ -15,9 +15,11 @@ set_global("document", {
execCommand: noop,
});
+const admin_emails_val = "[email protected]";
+
$("body").append = noop;
$(input).val = (arg) => {
- assert.equal(arg, "[email protected]");
+ assert.equal(arg, admin_emails_val);
return {
trigger: noop,
};
@@ -41,20 +43,25 @@ run_test("phrase_match", () => {
});
run_test("copy_data_attribute_value", () => {
- const elem = $.create(".envelope-link");
+ const elem = {};
+ let faded_in = false;
+ let faded_out = false;
+
elem.data = (key) => {
- if (key === "admin-emails") {
- return "[email protected]";
- }
- return "";
+ assert.equal(key, "admin-emails");
+ return admin_emails_val;
};
elem.fadeOut = (val) => {
assert.equal(val, 250);
+ faded_out = true;
};
elem.fadeIn = (val) => {
assert.equal(val, 1000);
+ faded_in = true;
};
common.copy_data_attribute_value(elem, "admin-emails");
+ assert(faded_in);
+ assert(faded_out);
});
run_test("adjust_mac_shortcuts non-mac", () => {