js: Convert static/js/page_params.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-03-25 14:35:45 -07:00
committed by Tim Abbott
parent bb1b2048bd
commit 38ffd47b90
158 changed files with 297 additions and 270 deletions

View File

@@ -6,10 +6,9 @@ const _ = require("lodash");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
let page_params = set_global("page_params", {
realm_push_notifications_enabled: false,
});
page_params.realm_push_notifications_enabled = false;
const muting = zrequire("muting");
@@ -47,19 +46,13 @@ function assert_zero_counts(counts) {
}
function test_notifiable_count(home_unread_messages, expected_notifiable_count) {
page_params = set_global("page_params", {
desktop_icon_count_display: 1,
});
page_params.desktop_icon_count_display = 1;
let notifiable_counts = unread.get_notifiable_count();
assert.deepEqual(notifiable_counts, home_unread_messages);
page_params = set_global("page_params", {
desktop_icon_count_display: 2,
});
page_params.desktop_icon_count_display = 2;
notifiable_counts = unread.get_notifiable_count();
assert.deepEqual(notifiable_counts, expected_notifiable_count);
page_params = set_global("page_params", {
desktop_icon_count_display: 3,
});
page_params.desktop_icon_count_display = 3;
notifiable_counts = unread.get_notifiable_count();
assert.deepEqual(notifiable_counts, 0);
}