mirror of https://github.com/zulip/zulip.git
node tests: Fix zjquery leaks in alert_words_ui.
This commit is contained in:
parent
0124264a9e
commit
569b12439d
|
@ -18,7 +18,12 @@ alert_words.initialize({
|
||||||
alert_words: ["foo", "bar"],
|
alert_words: ["foo", "bar"],
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("render_alert_words_ui", () => {
|
function test_ui(label, f) {
|
||||||
|
$.clear_all_elements();
|
||||||
|
run_test(label, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
test_ui("render_alert_words_ui", () => {
|
||||||
const word_list = $("#alert_words_list");
|
const word_list = $("#alert_words_list");
|
||||||
const appended = [];
|
const appended = [];
|
||||||
word_list.append = (rendered) => {
|
word_list.append = (rendered) => {
|
||||||
|
@ -42,8 +47,8 @@ run_test("render_alert_words_ui", () => {
|
||||||
assert(new_alert_word.is_focused());
|
assert(new_alert_word.is_focused());
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("add_alert_word", () => {
|
test_ui("add_alert_word", (override) => {
|
||||||
alert_words_ui.render_alert_words_ui = () => {}; // we've already tested this above
|
override(alert_words_ui, "render_alert_words_ui", () => {}); // we've already tested this above
|
||||||
|
|
||||||
alert_words_ui.set_up_alert_words();
|
alert_words_ui.set_up_alert_words();
|
||||||
|
|
||||||
|
@ -97,7 +102,10 @@ run_test("add_alert_word", () => {
|
||||||
assert(alert_word_status.visible());
|
assert(alert_word_status.visible());
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("add_alert_word_keypress", () => {
|
test_ui("add_alert_word_keypress", (override) => {
|
||||||
|
override(alert_words_ui, "render_alert_words_ui", () => {});
|
||||||
|
alert_words_ui.set_up_alert_words();
|
||||||
|
|
||||||
const create_form = $("#create_alert_word_form");
|
const create_form = $("#create_alert_word_form");
|
||||||
const keypress_func = create_form.get_on_handler("keypress", "#create_alert_word_name");
|
const keypress_func = create_form.get_on_handler("keypress", "#create_alert_word_name");
|
||||||
|
|
||||||
|
@ -120,7 +128,10 @@ run_test("add_alert_word_keypress", () => {
|
||||||
assert(called);
|
assert(called);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("remove_alert_word", () => {
|
test_ui("remove_alert_word", (override) => {
|
||||||
|
override(alert_words_ui, "render_alert_words_ui", () => {});
|
||||||
|
alert_words_ui.set_up_alert_words();
|
||||||
|
|
||||||
const word_list = $("#alert_words_list");
|
const word_list = $("#alert_words_list");
|
||||||
const remove_func = word_list.get_on_handler("click", ".remove-alert-word");
|
const remove_func = word_list.get_on_handler("click", ".remove-alert-word");
|
||||||
|
|
||||||
|
@ -164,7 +175,10 @@ run_test("remove_alert_word", () => {
|
||||||
assert(alert_word_status.visible());
|
assert(alert_word_status.visible());
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("close_status_message", () => {
|
test_ui("close_status_message", (override) => {
|
||||||
|
override(alert_words_ui, "render_alert_words_ui", () => {});
|
||||||
|
alert_words_ui.set_up_alert_words();
|
||||||
|
|
||||||
const alert_word_settings = $("#alert-word-settings");
|
const alert_word_settings = $("#alert-word-settings");
|
||||||
const close = alert_word_settings.get_on_handler("click", ".close-alert-word-status");
|
const close = alert_word_settings.get_on_handler("click", ".close-alert-word-status");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue