mirror of https://github.com/zulip/zulip.git
node_tests: Don’t read page_params from deprecated global variable.
Follow up to commit 89aa3155a9
(#17262).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
be9ae9dac8
commit
7e3735b9ba
|
@ -112,16 +112,14 @@
|
||||||
"current_msg_list": false,
|
"current_msg_list": false,
|
||||||
"home_msg_list": false,
|
"home_msg_list": false,
|
||||||
"i18n": false,
|
"i18n": false,
|
||||||
"location": false,
|
"location": false
|
||||||
"page_params": false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],
|
"files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],
|
||||||
"globals": {
|
"globals": {
|
||||||
"$": false,
|
"$": false,
|
||||||
"current_msg_list": false,
|
"current_msg_list": false
|
||||||
"page_params": false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,10 +14,10 @@ let filter_key_handlers;
|
||||||
|
|
||||||
const huddle_data = zrequire("huddle_data");
|
const huddle_data = zrequire("huddle_data");
|
||||||
|
|
||||||
const _page_params = {
|
let page_params = set_global("page_params", {
|
||||||
realm_users: [],
|
realm_users: [],
|
||||||
user_id: 999,
|
user_id: 999,
|
||||||
};
|
});
|
||||||
|
|
||||||
const _document = {
|
const _document = {
|
||||||
hasFocus() {
|
hasFocus() {
|
||||||
|
@ -69,7 +69,6 @@ set_global("channel", channel);
|
||||||
set_global("compose_state", compose_state);
|
set_global("compose_state", compose_state);
|
||||||
set_global("document", _document);
|
set_global("document", _document);
|
||||||
set_global("keydown_util", _keydown_util);
|
set_global("keydown_util", _keydown_util);
|
||||||
set_global("page_params", _page_params);
|
|
||||||
set_global("pm_list", _pm_list);
|
set_global("pm_list", _pm_list);
|
||||||
set_global("popovers", _popovers);
|
set_global("popovers", _popovers);
|
||||||
set_global("resize", _resize);
|
set_global("resize", _resize);
|
||||||
|
@ -749,7 +748,7 @@ test_ui("electron_bridge", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test_ui("test_send_or_receive_no_presence_for_web_public_visitor", () => {
|
test_ui("test_send_or_receive_no_presence_for_web_public_visitor", () => {
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
is_web_public_visitor: true,
|
is_web_public_visitor: true,
|
||||||
});
|
});
|
||||||
activity.send_presence_to_server();
|
activity.send_presence_to_server();
|
||||||
|
|
|
@ -14,7 +14,7 @@ const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
|
||||||
const dom = new JSDOM(template, {pretendToBeVisual: true});
|
const dom = new JSDOM(template, {pretendToBeVisual: true});
|
||||||
const jquery = jQueryFactory(dom.window);
|
const jquery = jQueryFactory(dom.window);
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
const loading = set_global("loading", {});
|
const loading = set_global("loading", {});
|
||||||
const history = set_global("history", {});
|
const history = set_global("history", {});
|
||||||
set_global("document", {
|
set_global("document", {
|
||||||
|
|
|
@ -7,9 +7,8 @@ const _ = require("lodash");
|
||||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
const _page_params = {};
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
set_global("page_params", _page_params);
|
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
||||||
const presence = zrequire("presence");
|
const presence = zrequire("presence");
|
||||||
const user_status = zrequire("user_status");
|
const user_status = zrequire("user_status");
|
||||||
|
|
|
@ -61,7 +61,7 @@ const channel = set_global("channel", {});
|
||||||
const stream_edit = set_global("stream_edit", {});
|
const stream_edit = set_global("stream_edit", {});
|
||||||
const markdown = set_global("markdown", {});
|
const markdown = set_global("markdown", {});
|
||||||
const loading = set_global("loading", {});
|
const loading = set_global("loading", {});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
const resize = set_global("resize", {});
|
const resize = set_global("resize", {});
|
||||||
const subs = set_global("subs", {});
|
const subs = set_global("subs", {});
|
||||||
const ui_util = set_global("ui_util", {});
|
const ui_util = set_global("ui_util", {});
|
||||||
|
|
|
@ -171,7 +171,7 @@ stream_data.add_sub(sweden_stream);
|
||||||
stream_data.add_sub(denmark_stream);
|
stream_data.add_sub(denmark_stream);
|
||||||
stream_data.add_sub(netherland_stream);
|
stream_data.add_sub(netherland_stream);
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
const channel = set_global("channel", {});
|
const channel = set_global("channel", {});
|
||||||
const compose = set_global("compose", {
|
const compose = set_global("compose", {
|
||||||
finish: noop,
|
finish: noop,
|
||||||
|
|
|
@ -63,7 +63,7 @@ const user_events = set_global("user_events", {});
|
||||||
const user_groups = set_global("user_groups", {});
|
const user_groups = set_global("user_groups", {});
|
||||||
|
|
||||||
// page_params is highly coupled to dispatching now
|
// page_params is highly coupled to dispatching now
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
test_suite: false,
|
test_suite: false,
|
||||||
is_admin: true,
|
is_admin: true,
|
||||||
realm_description: "already set description",
|
realm_description: "already set description",
|
||||||
|
|
|
@ -9,7 +9,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
const local_message = set_global("local_message", {});
|
const local_message = set_global("local_message", {});
|
||||||
const markdown = set_global("markdown", {});
|
const markdown = set_global("markdown", {});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
const fake_now = 555;
|
const fake_now = 555;
|
||||||
MockDate.set(new Date(fake_now * 1000));
|
MockDate.set(new Date(fake_now * 1000));
|
||||||
|
|
|
@ -13,7 +13,7 @@ zrequire("message_util", "js/message_util");
|
||||||
const Filter = zrequire("Filter", "js/filter");
|
const Filter = zrequire("Filter", "js/filter");
|
||||||
|
|
||||||
const message_store = set_global("message_store", {});
|
const message_store = set_global("message_store", {});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
const me = {
|
const me = {
|
||||||
email: "me@example.com",
|
email: "me@example.com",
|
||||||
|
|
|
@ -25,7 +25,7 @@ set_global("navigator", {
|
||||||
platform: "",
|
platform: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
let overlays = set_global("overlays", {});
|
let overlays = set_global("overlays", {});
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ const emoji_params = {
|
||||||
emoji_codes,
|
emoji_codes,
|
||||||
};
|
};
|
||||||
|
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
realm_users: [],
|
realm_users: [],
|
||||||
realm_filters: [
|
realm_filters: [
|
||||||
["#(?P<id>[0-9]{2,8})", "https://trac.example.com/ticket/%(id)s"],
|
["#(?P<id>[0-9]{2,8})", "https://trac.example.com/ticket/%(id)s"],
|
||||||
|
|
|
@ -5,7 +5,7 @@ const {strict: assert} = require("assert");
|
||||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
set_global("page_params", {
|
let page_params = set_global("page_params", {
|
||||||
realm_community_topic_editing_limit_seconds: 259200,
|
realm_community_topic_editing_limit_seconds: 259200,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -51,19 +51,19 @@ run_test("get_editability", () => {
|
||||||
sent_by_me: true,
|
sent_by_me: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
realm_allow_message_editing: false,
|
realm_allow_message_editing: false,
|
||||||
});
|
});
|
||||||
assert.equal(get_editability(message), editability_types.NO);
|
assert.equal(get_editability(message), editability_types.NO);
|
||||||
|
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
realm_allow_message_editing: true,
|
realm_allow_message_editing: true,
|
||||||
// Limit of 0 means no time limit on editing messages
|
// Limit of 0 means no time limit on editing messages
|
||||||
realm_message_content_edit_limit_seconds: 0,
|
realm_message_content_edit_limit_seconds: 0,
|
||||||
});
|
});
|
||||||
assert.equal(get_editability(message), editability_types.FULL);
|
assert.equal(get_editability(message), editability_types.FULL);
|
||||||
|
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
realm_allow_message_editing: true,
|
realm_allow_message_editing: true,
|
||||||
realm_message_content_edit_limit_seconds: 10,
|
realm_message_content_edit_limit_seconds: 10,
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,7 @@ run_test("get_editability", () => {
|
||||||
sent_by_me: false,
|
sent_by_me: false,
|
||||||
type: "stream",
|
type: "stream",
|
||||||
};
|
};
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
realm_allow_community_topic_editing: true,
|
realm_allow_community_topic_editing: true,
|
||||||
realm_allow_message_editing: true,
|
realm_allow_message_editing: true,
|
||||||
realm_message_content_edit_limit_seconds: 0,
|
realm_message_content_edit_limit_seconds: 0,
|
||||||
|
@ -116,7 +116,7 @@ run_test("get_editability", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("get_deletability", () => {
|
run_test("get_deletability", () => {
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
is_admin: true,
|
is_admin: true,
|
||||||
realm_allow_message_deleting: false,
|
realm_allow_message_deleting: false,
|
||||||
realm_message_content_delete_limit_seconds: 0,
|
realm_message_content_delete_limit_seconds: 0,
|
||||||
|
|
|
@ -19,7 +19,7 @@ set_global("current_msg_list", {});
|
||||||
const message_edit = set_global("message_edit", {});
|
const message_edit = set_global("message_edit", {});
|
||||||
const message_list = set_global("message_list", {});
|
const message_list = set_global("message_list", {});
|
||||||
const notifications = set_global("notifications", {});
|
const notifications = set_global("notifications", {});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
const pm_list = set_global("pm_list", {});
|
const pm_list = set_global("pm_list", {});
|
||||||
const stream_list = set_global("stream_list", {});
|
const stream_list = set_global("stream_list", {});
|
||||||
const unread_ui = set_global("unread_ui", {});
|
const unread_ui = set_global("unread_ui", {});
|
||||||
|
|
|
@ -17,7 +17,7 @@ const message_list = zrequire("message_list");
|
||||||
|
|
||||||
const noop = function () {};
|
const noop = function () {};
|
||||||
|
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
twenty_four_hour_time: false,
|
twenty_four_hour_time: false,
|
||||||
});
|
});
|
||||||
set_global("home_msg_list", "stub");
|
set_global("home_msg_list", "stub");
|
||||||
|
|
|
@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
zrequire("timerender");
|
zrequire("timerender");
|
||||||
const muting = zrequire("muting");
|
const muting = zrequire("muting");
|
||||||
const stream_data = zrequire("stream_data");
|
const stream_data = zrequire("stream_data");
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
run_test("edge_cases", () => {
|
run_test("edge_cases", () => {
|
||||||
// private messages
|
// private messages
|
||||||
|
|
|
@ -14,7 +14,7 @@ set_global("document", {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
realm_users: [],
|
realm_users: [],
|
||||||
enable_desktop_notifications: true,
|
enable_desktop_notifications: true,
|
||||||
|
|
|
@ -10,7 +10,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
const message_store = set_global("message_store", {});
|
const message_store = set_global("message_store", {});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
||||||
const settings_config = zrequire("settings_config");
|
const settings_config = zrequire("settings_config");
|
||||||
|
|
|
@ -65,7 +65,7 @@ const $array = (array) => {
|
||||||
return {each};
|
return {each};
|
||||||
};
|
};
|
||||||
|
|
||||||
set_global("page_params", {emojiset: "apple"});
|
let page_params = set_global("page_params", {emojiset: "apple"});
|
||||||
|
|
||||||
const get_content_element = () => {
|
const get_content_element = () => {
|
||||||
$.clear_all_elements();
|
$.clear_all_elements();
|
||||||
|
@ -197,16 +197,16 @@ run_test("timestamp-twenty-four-hour-time", () => {
|
||||||
// We will temporarily change the 24h setting for this test.
|
// We will temporarily change the 24h setting for this test.
|
||||||
const old_page_params = page_params;
|
const old_page_params = page_params;
|
||||||
|
|
||||||
set_global("page_params", {...old_page_params, twenty_four_hour_time: true});
|
page_params = set_global("page_params", {...old_page_params, twenty_four_hour_time: true});
|
||||||
rm.update_elements($content);
|
rm.update_elements($content);
|
||||||
assert.equal($timestamp.text(), "Wed, Jul 15 2020, 20:40");
|
assert.equal($timestamp.text(), "Wed, Jul 15 2020, 20:40");
|
||||||
|
|
||||||
set_global("page_params", {...old_page_params, twenty_four_hour_time: false});
|
page_params = set_global("page_params", {...old_page_params, twenty_four_hour_time: false});
|
||||||
rm.update_elements($content);
|
rm.update_elements($content);
|
||||||
assert.equal($timestamp.text(), "Wed, Jul 15 2020, 8:40 PM");
|
assert.equal($timestamp.text(), "Wed, Jul 15 2020, 8:40 PM");
|
||||||
|
|
||||||
// Set page_params back to its original value.
|
// Set page_params back to its original value.
|
||||||
set_global("page_params", old_page_params);
|
page_params = set_global("page_params", old_page_params);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("timestamp-error", () => {
|
run_test("timestamp-error", () => {
|
||||||
|
|
|
@ -5,7 +5,7 @@ const {strict: assert} = require("assert");
|
||||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
search_pills_enabled: true,
|
search_pills_enabled: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const {strict: assert} = require("assert");
|
||||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
search_pills_enabled: false,
|
search_pills_enabled: false,
|
||||||
});
|
});
|
||||||
set_global("message_store", {
|
set_global("message_store", {
|
||||||
|
|
|
@ -8,7 +8,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
const $ = require("../zjsunit/zjquery");
|
const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
realm_uri: "https://chat.example.com",
|
realm_uri: "https://chat.example.com",
|
||||||
realm_embedded_bots: [
|
realm_embedded_bots: [
|
||||||
{name: "converter", config: {}},
|
{name: "converter", config: {}},
|
||||||
|
|
|
@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
const settings_data = zrequire("settings_data");
|
const settings_data = zrequire("settings_data");
|
||||||
const settings_config = zrequire("settings_config");
|
const settings_config = zrequire("settings_config");
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some methods in settings_data are fairly
|
Some methods in settings_data are fairly
|
||||||
|
|
|
@ -30,14 +30,14 @@ const _loading = {
|
||||||
destroy_indicator: noop,
|
destroy_indicator: noop,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _page_params = {
|
const page_params = set_global("page_params", {
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
realm_domains: [
|
realm_domains: [
|
||||||
{domain: "example.com", allow_subdomains: true},
|
{domain: "example.com", allow_subdomains: true},
|
||||||
{domain: "example.org", allow_subdomains: false},
|
{domain: "example.org", allow_subdomains: false},
|
||||||
],
|
],
|
||||||
realm_authentication_methods: {},
|
realm_authentication_methods: {},
|
||||||
};
|
});
|
||||||
|
|
||||||
const realm_icon = set_global("realm_icon", {});
|
const realm_icon = set_global("realm_icon", {});
|
||||||
const channel = set_global("channel", {});
|
const channel = set_global("channel", {});
|
||||||
|
@ -74,7 +74,6 @@ set_global("csrf_token", "token-stub");
|
||||||
set_global("FormData", _FormData);
|
set_global("FormData", _FormData);
|
||||||
set_global("jQuery", _jQuery);
|
set_global("jQuery", _jQuery);
|
||||||
set_global("loading", _loading);
|
set_global("loading", _loading);
|
||||||
set_global("page_params", _page_params);
|
|
||||||
set_global("realm_logo", _realm_logo);
|
set_global("realm_logo", _realm_logo);
|
||||||
set_global("ui_report", _ui_report);
|
set_global("ui_report", _ui_report);
|
||||||
set_global("ListWidget", _ListWidget);
|
set_global("ListWidget", _ListWidget);
|
||||||
|
|
|
@ -9,7 +9,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
const $ = require("../zjsunit/zjquery");
|
const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
const loading = set_global("loading", {});
|
const loading = set_global("loading", {});
|
||||||
|
|
||||||
const SHORT_TEXT_ID = 1;
|
const SHORT_TEXT_ID = 1;
|
||||||
|
|
|
@ -34,7 +34,7 @@ const ui_report = set_global("ui_report", {});
|
||||||
|
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
function reset_test_setup(pill_container_stub) {
|
function reset_test_setup(pill_container_stub) {
|
||||||
function input_pill_stub(opts) {
|
function input_pill_stub(opts) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ const _ = require("lodash");
|
||||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
realm_users: [],
|
realm_users: [],
|
||||||
is_guest: false,
|
is_guest: false,
|
||||||
|
|
|
@ -19,7 +19,7 @@ set_global("hash_util", {
|
||||||
set_global("ListWidget", {
|
set_global("ListWidget", {
|
||||||
create: () => ({init: noop}),
|
create: () => ({init: noop}),
|
||||||
});
|
});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
set_global("settings_notifications", {
|
set_global("settings_notifications", {
|
||||||
get_notifications_table_row_data: noop,
|
get_notifications_table_row_data: noop,
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,7 @@ const scroll_util = zrequire("scroll_util");
|
||||||
zrequire("list_cursor");
|
zrequire("list_cursor");
|
||||||
const stream_list = zrequire("stream_list");
|
const stream_list = zrequire("stream_list");
|
||||||
zrequire("ui");
|
zrequire("ui");
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
realm_users: [],
|
realm_users: [],
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
const $ = require("../zjsunit/zjquery");
|
const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
set_global("page_params", {
|
let page_params = set_global("page_params", {
|
||||||
twenty_four_hour_time: true,
|
twenty_four_hour_time: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ run_test("get_timestamp_for_flatpickr", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("absolute_time_12_hour", () => {
|
run_test("absolute_time_12_hour", () => {
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
twenty_four_hour_time: false,
|
twenty_four_hour_time: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ run_test("absolute_time_12_hour", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("absolute_time_24_hour", () => {
|
run_test("absolute_time_24_hour", () => {
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
twenty_four_hour_time: true,
|
twenty_four_hour_time: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
const noop = function () {};
|
const noop = function () {};
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
const channel = set_global("channel", {});
|
const channel = set_global("channel", {});
|
||||||
const reload = set_global("reload", {});
|
const reload = set_global("reload", {});
|
||||||
const reload_state = set_global("reload_state", {});
|
const reload_state = set_global("reload_state", {});
|
||||||
|
|
|
@ -6,7 +6,7 @@ const {stub_templates} = require("../zjsunit/handlebars");
|
||||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
set_global("page_params", {realm_is_zephyr_mirror_realm: false});
|
const page_params = set_global("page_params", {realm_is_zephyr_mirror_realm: false});
|
||||||
|
|
||||||
const settings_config = zrequire("settings_config");
|
const settings_config = zrequire("settings_config");
|
||||||
const pm_conversations = zrequire("pm_conversations");
|
const pm_conversations = zrequire("pm_conversations");
|
||||||
|
|
|
@ -40,7 +40,7 @@ set_global("csrf_token", "whatever");
|
||||||
|
|
||||||
set_global("$", () => {});
|
set_global("$", () => {});
|
||||||
const resize = set_global("resize", {});
|
const resize = set_global("resize", {});
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
const ignore_modules = [
|
const ignore_modules = [
|
||||||
"activity",
|
"activity",
|
||||||
|
|
|
@ -12,7 +12,7 @@ const people = zrequire("people");
|
||||||
const stream_data = zrequire("stream_data");
|
const stream_data = zrequire("stream_data");
|
||||||
const unread = zrequire("unread");
|
const unread = zrequire("unread");
|
||||||
|
|
||||||
set_global("page_params", {
|
let page_params = set_global("page_params", {
|
||||||
realm_push_notifications_enabled: false,
|
realm_push_notifications_enabled: false,
|
||||||
});
|
});
|
||||||
zrequire("settings_notifications");
|
zrequire("settings_notifications");
|
||||||
|
@ -49,17 +49,17 @@ function assert_zero_counts(counts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_notifiable_count(home_unread_messages, expected_notifiable_count) {
|
function test_notifiable_count(home_unread_messages, expected_notifiable_count) {
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
desktop_icon_count_display: 1,
|
desktop_icon_count_display: 1,
|
||||||
});
|
});
|
||||||
let notifiable_counts = unread.get_notifiable_count();
|
let notifiable_counts = unread.get_notifiable_count();
|
||||||
assert.deepEqual(notifiable_counts, home_unread_messages);
|
assert.deepEqual(notifiable_counts, home_unread_messages);
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
desktop_icon_count_display: 2,
|
desktop_icon_count_display: 2,
|
||||||
});
|
});
|
||||||
notifiable_counts = unread.get_notifiable_count();
|
notifiable_counts = unread.get_notifiable_count();
|
||||||
assert.deepEqual(notifiable_counts, expected_notifiable_count);
|
assert.deepEqual(notifiable_counts, expected_notifiable_count);
|
||||||
set_global("page_params", {
|
page_params = set_global("page_params", {
|
||||||
desktop_icon_count_display: 3,
|
desktop_icon_count_display: 3,
|
||||||
});
|
});
|
||||||
notifiable_counts = unread.get_notifiable_count();
|
notifiable_counts = unread.get_notifiable_count();
|
||||||
|
|
|
@ -14,7 +14,7 @@ set_global("document", {
|
||||||
set_global("navigator", {
|
set_global("navigator", {
|
||||||
userAgent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
|
userAgent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
|
||||||
});
|
});
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
max_file_upload_size: 25,
|
max_file_upload_size: 25,
|
||||||
});
|
});
|
||||||
set_global("csrf_token", "csrf_token");
|
set_global("csrf_token", "csrf_token");
|
||||||
|
|
|
@ -32,7 +32,7 @@ set_global("settings_users", {
|
||||||
set_global("gear_menu", {
|
set_global("gear_menu", {
|
||||||
update_org_settings_menu_item() {},
|
update_org_settings_menu_item() {},
|
||||||
});
|
});
|
||||||
set_global("page_params", {
|
const page_params = set_global("page_params", {
|
||||||
is_admin: true,
|
is_admin: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
||||||
const user_pill = zrequire("user_pill");
|
const user_pill = zrequire("user_pill");
|
||||||
|
|
||||||
set_global("page_params", {});
|
const page_params = set_global("page_params", {});
|
||||||
|
|
||||||
const alice = {
|
const alice = {
|
||||||
email: "alice@example.com",
|
email: "alice@example.com",
|
||||||
|
|
Loading…
Reference in New Issue