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