Files
zulip/frontend_tests/node_tests/ui.js
Anders Kaseorg 28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00

22 lines
919 B
JavaScript

const ui = zrequire('ui');
set_global('i18n', global.stub_i18n);
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(expected, actual);
});
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(expected, actual);
// Reset userAgent
global.navigator.userAgent = '';
});