Files
zulip/frontend_tests/node_tests/ui.js
Steve Howell b994889315 node tests: Just set i18n every time.
Explicitly stubbing i18n in 48 different files
is mostly busy work at this point, and it doesn't
provide much signal, since often it's invoked
only to satisfy transitive dependencies.
2020-02-28 17:11:24 -08:00

21 lines
881 B
JavaScript

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(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 = '';
});