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.

recent_topics: Explicitly override is_visible & is_in_focus in tests.

YashRE42d8ddfdb1270f
diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js
index 7509e65fc28..8aa657f5574 100644
--- a/frontend_tests/node_tests/recent_topics.js
+++ b/frontend_tests/node_tests/recent_topics.js
@@ -414,6 +414,7 @@ test("test_filter_all", ({override, mock_template}) => {
row_data = generate_topic_data([[1, "topic-1", 0, false, true]]);
i = row_data.length;
rt.set_default_focus();
+ override(rt, "is_in_focus", () => false);
assert.equal(rt.inplace_rerender("1:topic-1"), true);
});
@@ -464,6 +465,7 @@ test("test_filter_unread", ({override, mock_template}) => {
stub_out_filter_buttons();
rt.process_messages(messages);
+ override(rt, "is_in_focus", () => false);
assert.equal(rt.inplace_rerender("1:topic-1"), true);
$("#recent_topics_filter_buttons").removeClass("btn-recent-selected");
@@ -571,6 +573,7 @@ test("test_filter_participated", ({override, mock_template}) => {
expected_filter_participated = false;
rt.process_messages(messages);
+ override(rt, "is_in_focus", () => false);
assert.equal(rt.inplace_rerender("1:topic-4"), true);
// Set muted filter
@@ -630,7 +633,8 @@ test("test_filter_participated", ({override, mock_template}) => {
rt.set_filter("all");
});
-test("test_update_unread_count", () => {
+test("test_update_unread_count", ({override}) => {
+ override(rt, "is_visible", () => false);
rt.clear_for_tests();
stub_out_filter_buttons();
rt.set_filter("all");
@@ -758,6 +762,7 @@ test("basic assertions", ({override, mock_template}) => {
// update_topic_is_muted now relies on external libraries completely
// so we don't need to check anythere here.
generate_topic_data([[1, topic1, 0, false, true]]);
+ override(rt, "is_in_focus", () => false);
assert.equal(rt.update_topic_is_muted(stream1, topic1), true);
// a topic gets muted which we are not tracking
assert.equal(rt.update_topic_is_muted(stream1, "topic-10"), false);
@@ -816,6 +821,7 @@ test("test_reify_local_echo_message", ({override, mock_template}) => {
});
test("test_delete_messages", ({override}) => {
+ override(rt, "is_visible", () => false);
rt.clear_for_tests();
stub_out_filter_buttons();
rt.set_filter("all");
@@ -855,6 +861,7 @@ test("test_delete_messages", ({override}) => {
test("test_topic_edit", ({override}) => {
override(all_messages_data, "all_messages", () => messages);
+ override(rt, "is_visible", () => false);
// NOTE: This test should always run in the end as it modified the messages data.
rt.clear_for_tests();