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.

ui_util: Use `.show` and `.hide` classes for unread counts visibility.

Lalitfb165f19016c
diff --git a/web/src/ui_util.ts b/web/src/ui_util.ts
index 378f30b18b8..896ccf73a2d 100644
--- a/web/src/ui_util.ts
+++ b/web/src/ui_util.ts
@@ -51,12 +51,12 @@ export function update_unread_count_in_dom($unread_count_elem: JQuery, count: nu
const $unread_count_span = $unread_count_elem.find(".unread_count");
if (count === 0) {
- $unread_count_span.hide();
+ $unread_count_span.addClass("hide");
$unread_count_span.text("");
return;
}
- $unread_count_span.show();
+ $unread_count_span.removeClass("hide");
$unread_count_span.text(count);
}
diff --git a/web/tests/pm_list.test.js b/web/tests/pm_list.test.js
index 0cf00a37a27..752225301a9 100644
--- a/web/tests/pm_list.test.js
+++ b/web/tests/pm_list.test.js
@@ -28,7 +28,7 @@ run_test("update_dom_with_unread_counts", () => {
pm_list.set_count(counts.private_message_count);
assert.equal($total_count.text(), "10");
- assert.ok($total_count.visible());
+ assert.equal($total_count.hasClass("hide"), false);
counts = {
private_message_count: 0,
@@ -36,5 +36,5 @@ run_test("update_dom_with_unread_counts", () => {
pm_list.set_count(counts.private_message_count);
assert.equal($total_count.text(), "");
- assert.ok(!$total_count.visible());
+ assert.equal($total_count.hasClass("hide"), true);
});