Files
zulip/frontend_tests/node_tests/ui.js
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00

26 lines
920 B
JavaScript

"use strict";
const ui = zrequire("ui");
set_global("navigator", {
userAgent: "",
});
run_test("get_hotkey_deprecation_notice", () => {
const expected =
'translated: We\'ve replaced the "*" hotkey with "Ctrl + s" to make this common shortcut easier to trigger.';
const actual = ui.get_hotkey_deprecation_notice("*", "Ctrl + s");
assert.equal(actual, expected);
});
run_test("get_hotkey_deprecation_notice_mac", () => {
global.navigator.userAgent =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36";
const expected =
'translated: We\'ve replaced the "*" hotkey with "Cmd + s" to make this common shortcut easier to trigger.';
const actual = ui.get_hotkey_deprecation_notice("*", "Cmd + s");
assert.equal(actual, expected);
// Reset userAgent
global.navigator.userAgent = "";
});