2020-08-01 03:43:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
2020-11-30 23:46:45 +01:00
|
|
|
const {strict: assert} = require("assert");
|
|
|
|
|
2020-12-01 00:02:16 +01:00
|
|
|
const {set_global, zrequire} = require("../zjsunit/namespace");
|
2020-12-01 00:39:47 +01:00
|
|
|
const {run_test} = require("../zjsunit/test");
|
2020-12-01 00:02:16 +01:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
set_global("navigator", {
|
|
|
|
userAgent: "",
|
2018-09-20 10:17:51 +02:00
|
|
|
});
|
|
|
|
|
2020-12-01 23:21:38 +01:00
|
|
|
const ui = zrequire("ui");
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
run_test("get_hotkey_deprecation_notice", () => {
|
2020-07-15 00:34:28 +02:00
|
|
|
const expected =
|
|
|
|
'translated: We\'ve replaced the "*" hotkey with "Ctrl + s" to make this common shortcut easier to trigger.';
|
2020-07-15 01:29:15 +02:00
|
|
|
const actual = ui.get_hotkey_deprecation_notice("*", "Ctrl + s");
|
2020-07-28 17:00:59 +02:00
|
|
|
assert.equal(actual, expected);
|
2018-07-21 02:19:14 +02:00
|
|
|
});
|
2018-09-20 10:17:51 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
run_test("get_hotkey_deprecation_notice_mac", () => {
|
2020-12-01 00:57:57 +01:00
|
|
|
navigator.userAgent =
|
2020-07-15 00:34:28 +02:00
|
|
|
"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.';
|
2020-07-15 01:29:15 +02:00
|
|
|
const actual = ui.get_hotkey_deprecation_notice("*", "Cmd + s");
|
2020-07-28 17:00:59 +02:00
|
|
|
assert.equal(actual, expected);
|
2018-09-20 10:17:51 +02:00
|
|
|
// Reset userAgent
|
2020-12-01 00:57:57 +01:00
|
|
|
navigator.userAgent = "";
|
2018-09-20 10:17:51 +02:00
|
|
|
});
|