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

This is a prep commit for introducing new "Show unread counts for" user
display setting. We should use css classes like `.hide` to hide the unread
count from the DOM as opposed to using `$unread_count_span.hide()` because
this injects inline styles and hence we won't be able to change the `display`
style on hovering for unread counts.
This commit is contained in:
Lalit
2023-04-25 16:33:05 +05:30
committed by Tim Abbott
parent f36c9c255b
commit fb165f1901
2 changed files with 4 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -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);
});