node tests: Make setup for ui_init more local.

This commit is contained in:
Steve Howell 2021-02-21 13:35:54 +00:00 committed by Steve Howell
parent b72575d98b
commit 895179e8f6
1 changed files with 65 additions and 65 deletions

View File

@ -77,10 +77,6 @@ const {server_events, ui} = Object.fromEntries(
]), ]),
); );
util.is_mobile = () => false;
stub_templates(() => "some-html");
ui.get_scroll_element = (element) => element;
zrequire("hash_util"); zrequire("hash_util");
zrequire("stream_color"); zrequire("stream_color");
zrequire("stream_edit"); zrequire("stream_edit");
@ -124,6 +120,11 @@ const ui_init = rewiremock.proxy(() => zrequire("ui_init"), {
set_global("$", make_zjquery()); set_global("$", make_zjquery());
run_test("initialize_everything", () => {
util.is_mobile = () => false;
stub_templates(() => "some-html");
ui.get_scroll_element = (element) => element;
const document_stub = $.create("document-stub"); const document_stub = $.create("document-stub");
document.to_$ = () => document_stub; document.to_$ = () => document_stub;
document_stub.idle = () => {}; document_stub.idle = () => {};
@ -185,6 +186,5 @@ $message_view_header.find = () => false;
compose.compute_show_video_chat_button = () => {}; compose.compute_show_video_chat_button = () => {};
$("#below-compose-content .video_link").toggle = () => {}; $("#below-compose-content .video_link").toggle = () => {};
run_test("initialize_everything", () => {
ui_init.initialize_everything(); ui_init.initialize_everything();
}); });