mirror of https://github.com/zulip/zulip.git
zjsunit: Deglobalize namespace.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
7b03d48798
commit
425f1789e2
|
@ -362,11 +362,7 @@
|
|||
"files": ["frontend_tests/**"],
|
||||
"globals": {
|
||||
"document": false,
|
||||
"reset_module": false,
|
||||
"set_global": false,
|
||||
"window": false,
|
||||
"with_field": false,
|
||||
"zrequire": false
|
||||
"window": false
|
||||
},
|
||||
"rules": {
|
||||
"no-sync": "off"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
const window_stub = $.create("window-stub");
|
||||
set_global("to_$", () => window_stub);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const params = {
|
||||
alert_words: ["alertone", "alerttwo", "alertthree", "al*rt.*s", ".+", "emoji"],
|
||||
};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
set_global("channel", {});
|
||||
|
|
|
@ -5,6 +5,8 @@ const fs = require("fs");
|
|||
|
||||
const {JSDOM} = require("jsdom");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const noop = () => {};
|
||||
const template = fs.readFileSync("templates/corporate/billing.html", "utf-8");
|
||||
const dom = new JSDOM(template, {pretendToBeVisual: true});
|
||||
|
|
|
@ -6,6 +6,8 @@ const fs = require("fs");
|
|||
const JQuery = require("jquery");
|
||||
const {JSDOM} = require("jsdom");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
|
||||
const dom = new JSDOM(template, {pretendToBeVisual: true});
|
||||
const jquery = JQuery(dom.window);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
|
||||
|
||||
run_test("clean_path", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const _settings_bots = {
|
||||
render_bots: () => {},
|
||||
};
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const _page_params = {};
|
||||
|
||||
set_global("page_params", _page_params);
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
const people = zrequire("people");
|
||||
zrequire("buddy_data");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", {});
|
||||
|
||||
set_global("reload", {});
|
||||
|
@ -249,7 +251,7 @@ run_test("retry", () => {
|
|||
},
|
||||
|
||||
check_ajax_options(options) {
|
||||
global.patch_builtin("setTimeout", (f, delay) => {
|
||||
set_global("setTimeout", (f, delay) => {
|
||||
assert.equal(delay, 0);
|
||||
f();
|
||||
});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("color_data");
|
||||
|
||||
run_test("pick_color", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("colorspace");
|
||||
|
||||
run_test("sRGB_to_linear", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("keydown_util");
|
||||
zrequire("components");
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ const {strict: assert} = require("assert");
|
|||
const {JSDOM} = require("jsdom");
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const events = require("./lib/events");
|
||||
|
||||
set_global("bridge", false);
|
||||
|
@ -721,7 +723,7 @@ run_test("send_message", () => {
|
|||
return stub_state;
|
||||
}
|
||||
|
||||
global.patch_builtin("setTimeout", (func) => {
|
||||
set_global("setTimeout", (func) => {
|
||||
func();
|
||||
});
|
||||
global.server_events = {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const noop = function () {};
|
||||
const return_false = function () {
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("stream_data");
|
||||
const people = zrequire("people");
|
||||
zrequire("compose_fade");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
const people = zrequire("people");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const autosize = require("autosize");
|
||||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("compose_ui");
|
||||
const people = zrequire("people");
|
||||
zrequire("user_status");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
const typeahead = zrequire("typeahead", "shared/js/typeahead");
|
||||
zrequire("compose_state");
|
||||
|
@ -331,7 +333,7 @@ run_test("content_typeahead_selected", () => {
|
|||
},
|
||||
});
|
||||
let set_timeout_called = false;
|
||||
global.patch_builtin("setTimeout", (f, time) => {
|
||||
set_global("setTimeout", (f, time) => {
|
||||
f();
|
||||
assert.equal(time, 0);
|
||||
set_timeout_called = true;
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
global.stub_out_jquery();
|
||||
const {JSDOM} = require("jsdom");
|
||||
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
stub_out_jquery();
|
||||
|
||||
set_global("page_params", {
|
||||
development_environment: true,
|
||||
});
|
||||
set_global("compose_ui", {});
|
||||
|
||||
const {JSDOM} = require("jsdom");
|
||||
|
||||
const {window} = new JSDOM("<!DOCTYPE html><p>Hello world</p>");
|
||||
const {DOMParser, document} = window;
|
||||
set_global("$", require("jquery")(window));
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const noop = function () {};
|
||||
|
||||
const events = require("./lib/events");
|
||||
|
@ -14,7 +16,7 @@ const typing_person1 = events.typing_person1;
|
|||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
global.patch_builtin("setTimeout", (func) => func());
|
||||
set_global("setTimeout", (func) => func());
|
||||
|
||||
set_global("activity", {});
|
||||
set_global("alert_words_ui", {});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const events = require("./lib/events");
|
||||
|
||||
const event_fixtures = events.fixtures;
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const XDate = require("xdate");
|
||||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
zrequire("localstorage");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("dropdown_list_widget");
|
||||
zrequire("scroll_util");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("markdown", {});
|
||||
set_global("local_message", {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
||||
|
||||
const events = require("./lib/events");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
zrequire("emoji_picker");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");
|
||||
|
||||
run_test("get_unused_fence", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const FetchStatus = zrequire("fetch_status");
|
||||
set_global("message_scroll", {
|
||||
hide_loading_older: () => {},
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("unread");
|
||||
zrequire("stream_data");
|
||||
const people = zrequire("people");
|
||||
global.stub_out_jquery();
|
||||
stub_out_jquery();
|
||||
set_global("$", global.make_zjquery());
|
||||
zrequire("message_util", "js/message_util");
|
||||
zrequire("Filter", "js/filter");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const {FoldDict} = zrequire("fold_dict");
|
||||
|
||||
run_test("basic", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
// This is a general tour of how to write node tests that
|
||||
// may also give you some quick insight on how the Zulip
|
||||
// browser app is constructed. Let's start with testing
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("hash_util");
|
||||
zrequire("stream_data");
|
||||
const people = zrequire("people");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
const window_stub = $.create("window-stub");
|
||||
set_global("location", {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, with_overrides, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
// Important note on these tests:
|
||||
//
|
||||
// The way the Zulip hotkey tests work is as follows. First, we set
|
||||
|
@ -80,7 +82,7 @@ function return_false() {
|
|||
}
|
||||
|
||||
function stubbing(func_name_to_stub, test_function) {
|
||||
global.with_overrides((override) => {
|
||||
with_overrides((override) => {
|
||||
global.with_stub((stub) => {
|
||||
override(func_name_to_stub, stub.f);
|
||||
test_function(stub);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("templates");
|
||||
|
||||
// We download our translations in `page_params` (which
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
zrequire("input_pill");
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
zrequire("keydown_util");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const {LazySet} = zrequire("lazy_set");
|
||||
|
||||
/*
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("rows");
|
||||
zrequire("lightbox");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("list_cursor");
|
||||
|
||||
run_test("config errors", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("list_render");
|
||||
|
||||
// We need these stubs to get by instanceof checks.
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("hash_util");
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const markdown_config = zrequire("markdown_config");
|
||||
|
||||
set_global("page_params", {});
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("document", null);
|
||||
set_global("page_params", {
|
||||
realm_community_topic_editing_limit_seconds: 86400,
|
||||
});
|
||||
|
||||
global.stub_out_jquery();
|
||||
stub_out_jquery();
|
||||
|
||||
zrequire("message_edit");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("message_events");
|
||||
zrequire("message_store");
|
||||
zrequire("muting");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("document", "document-stub");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("unread");
|
||||
zrequire("unread_ops");
|
||||
zrequire("message_flags");
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
// These unit tests for static/js/message_list.js emphasize the model-ish
|
||||
// aspects of the MessageList class. We have to stub out a few functions
|
||||
// related to views and events to get the tests working.
|
||||
|
@ -8,7 +10,7 @@ const {strict: assert} = require("assert");
|
|||
const noop = function () {};
|
||||
|
||||
set_global("Filter", noop);
|
||||
global.stub_out_jquery();
|
||||
stub_out_jquery();
|
||||
set_global("document", null);
|
||||
set_global("narrow_state", {});
|
||||
set_global("stream_data", {});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("unread");
|
||||
|
||||
zrequire("Filter", "js/filter");
|
||||
|
@ -11,7 +13,7 @@ zrequire("MessageListData", "js/message_list_data");
|
|||
set_global("page_params", {});
|
||||
set_global("muting", {});
|
||||
|
||||
global.patch_builtin("setTimeout", (f, delay) => {
|
||||
set_global("setTimeout", (f, delay) => {
|
||||
assert.equal(delay, 0);
|
||||
return f();
|
||||
});
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("document", "document-stub");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const util = zrequire("util");
|
||||
zrequire("pm_conversations");
|
||||
const people = zrequire("people");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("timerender");
|
||||
zrequire("muting");
|
||||
zrequire("stream_data");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
zrequire("hash_util");
|
||||
zrequire("hashchange");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const util = zrequire("util");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
|
@ -54,7 +56,7 @@ set_global("search_pill_widget", {
|
|||
//
|
||||
// We have strange hacks in narrow.activate to sleep 0
|
||||
// seconds.
|
||||
global.patch_builtin("setTimeout", (f, t) => {
|
||||
set_global("setTimeout", (f, t) => {
|
||||
assert.equal(t, 0);
|
||||
f();
|
||||
});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("Filter", "js/filter");
|
||||
zrequire("FetchStatus", "js/fetch_status");
|
||||
zrequire("MessageListData", "js/message_list_data");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const people = zrequire("people");
|
||||
zrequire("Filter", "js/filter");
|
||||
zrequire("stream_data");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("Filter", "js/filter");
|
||||
const people = zrequire("people");
|
||||
zrequire("stream_data");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
// Dependencies
|
||||
set_global(
|
||||
"$",
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("zxcvbn", zrequire("zxcvbn", "zxcvbn"));
|
||||
zrequire("common");
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ const _ = require("lodash");
|
|||
const moment = require("moment-timezone");
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const people = rewiremock.proxy(() => zrequire("people"), {
|
||||
"moment-timezone": () => moment("20130208T080910"),
|
||||
});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const return_false = function () {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const pmc = zrequire("pm_conversations");
|
||||
|
||||
run_test("partners", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
set_global("narrow_state", {});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("poll_widget");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
zrequire("hash_util");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const XDate = require("xdate");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const people = zrequire("people");
|
||||
zrequire("presence");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("document", "document-stub");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const rs = zrequire("recent_senders");
|
||||
|
||||
let next_id = 0;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {reset_module, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("message_util");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const rm = zrequire("rendered_markdown");
|
||||
const people = zrequire("people");
|
||||
zrequire("user_groups");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const rtl = zrequire("rtl");
|
||||
|
||||
run_test("get_direction", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("schema");
|
||||
|
||||
run_test("basics", () => {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("scroll_util");
|
||||
set_global("ui", {
|
||||
get_scroll_element: (element) => element,
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {
|
||||
search_pills_enabled: true,
|
||||
});
|
||||
|
@ -28,7 +30,7 @@ set_global("search_pill_widget", {
|
|||
},
|
||||
});
|
||||
|
||||
global.patch_builtin("setTimeout", (func) => func());
|
||||
set_global("setTimeout", (func) => func());
|
||||
|
||||
run_test("clear_search_form", () => {
|
||||
$("#search_query").val("noise");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {
|
||||
search_pills_enabled: false,
|
||||
});
|
||||
|
@ -21,7 +23,7 @@ set_global("ui_util", {
|
|||
set_global("narrow", {});
|
||||
set_global("Filter", {});
|
||||
|
||||
global.patch_builtin("setTimeout", (func) => func());
|
||||
set_global("setTimeout", (func) => func());
|
||||
|
||||
run_test("update_button_visibility", () => {
|
||||
const search_query = $("#search_query");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("search_pill");
|
||||
zrequire("input_pill");
|
||||
zrequire("Filter", "js/filter");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {
|
||||
search_pills_enabled: true,
|
||||
});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {
|
||||
search_pills_enabled: false,
|
||||
});
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const noop = function () {};
|
||||
|
||||
set_global("document", {});
|
||||
set_global("addEventListener", noop);
|
||||
global.stub_out_jquery();
|
||||
stub_out_jquery();
|
||||
|
||||
zrequire("message_store");
|
||||
zrequire("server_events_dispatch");
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {
|
||||
realm_uri: "https://chat.example.com",
|
||||
realm_embedded_bots: [
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const settings_data = zrequire("settings_data");
|
||||
const settings_config = zrequire("settings_config");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("upload_widget", {});
|
||||
zrequire("settings_emoji");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("XDate", zrequire("XDate", "xdate"));
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
const noop = () => {};
|
||||
|
@ -200,7 +202,7 @@ function test_submit_settings_form(submit_form) {
|
|||
realm_create_stream_policy: settings_config.create_stream_policy_values.by_members.code,
|
||||
});
|
||||
|
||||
global.patch_builtin("setTimeout", (func) => func());
|
||||
set_global("setTimeout", (func) => func());
|
||||
const ev = {
|
||||
preventDefault: noop,
|
||||
stopPropagation: noop,
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {});
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("loading", {});
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("user_pill");
|
||||
zrequire("pill_typeahead");
|
||||
zrequire("settings_user_groups");
|
||||
|
@ -329,7 +331,7 @@ run_test("populate_user_groups", () => {
|
|||
}
|
||||
|
||||
pills.onPillRemove = function (handler) {
|
||||
global.patch_builtin("setTimeout", (func) => {
|
||||
set_global("setTimeout", (func) => {
|
||||
func();
|
||||
});
|
||||
realm_user_group.members = new Set([2, 31]);
|
||||
|
@ -789,7 +791,7 @@ run_test("on_events", () => {
|
|||
assert.equal(opts.data.description, "translated: All mobile members");
|
||||
api_endpoint_called = true;
|
||||
(function test_post_success() {
|
||||
global.patch_builtin("setTimeout", (func) => {
|
||||
set_global("setTimeout", (func) => {
|
||||
func();
|
||||
});
|
||||
opts.success();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
zrequire("spoilers");
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("page_params", {
|
||||
is_admin: false,
|
||||
realm_users: [],
|
||||
|
@ -13,7 +15,7 @@ set_global("page_params", {
|
|||
set_global("$", () => {});
|
||||
|
||||
set_global("document", null);
|
||||
global.stub_out_jquery();
|
||||
stub_out_jquery();
|
||||
|
||||
zrequire("color_data");
|
||||
zrequire("hash_util");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const {LazySet} = zrequire("lazy_set");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
const noop = function () {};
|
||||
const return_true = function () {
|
||||
return true;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
set_global("document", "document-stub");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("stream_data");
|
||||
zrequire("stream_pill");
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
// This tests the stream searching functionality which currently
|
||||
// lives in stream_list.js.
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("stream_data");
|
||||
zrequire("stream_sort");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("unread");
|
||||
zrequire("stream_data");
|
||||
zrequire("stream_topic_history");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
zrequire("submessage");
|
||||
|
||||
set_global("channel", {});
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
global.stub_out_jquery();
|
||||
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
|
||||
|
||||
stub_out_jquery();
|
||||
|
||||
set_global("ui", {
|
||||
get_content_element: (element) => element,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue