зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268441 - Fix support of all non-letter characters. r=bgrins
This commit is contained in:
Родитель
0e659215da
Коммит
a3cd47760d
|
@ -122,7 +122,7 @@ KeyShortcuts.parseElectronKey = function (window, str) {
|
|||
}
|
||||
}
|
||||
|
||||
if (key.match(/^\w$/)) {
|
||||
if (typeof(key) === "string" && key.length === 1) {
|
||||
// Match any single character
|
||||
shortcut.key = key.toLowerCase();
|
||||
} else if (key in ElectronKeysMapping) {
|
||||
|
|
|
@ -8,6 +8,7 @@ add_task(function* () {
|
|||
window
|
||||
});
|
||||
yield testSimple(shortcuts);
|
||||
yield testNonLetterCharacter(shortcuts);
|
||||
yield testMixup(shortcuts);
|
||||
yield testExactModifiers(shortcuts);
|
||||
yield testLooseShiftModifier(shortcuts);
|
||||
|
@ -38,7 +39,6 @@ function once(shortcuts, key, listener) {
|
|||
function testSimple(shortcuts) {
|
||||
info("Test simple key shortcuts");
|
||||
|
||||
let called = false;
|
||||
let onKey = once(shortcuts, "0", (key, event) => {
|
||||
is(event.key, "0");
|
||||
|
||||
|
@ -50,6 +50,17 @@ function testSimple(shortcuts) {
|
|||
yield onKey;
|
||||
}
|
||||
|
||||
function testNonLetterCharacter(shortcuts) {
|
||||
info("Test non-naive character key shortcuts");
|
||||
|
||||
let onKey = once(shortcuts, "[", (key, event) => {
|
||||
is(event.key, "[");
|
||||
});
|
||||
|
||||
EventUtils.synthesizeKey("[", {}, window);
|
||||
yield onKey;
|
||||
}
|
||||
|
||||
// Test they listeners are not mixed up between shortcuts
|
||||
function testMixup(shortcuts) {
|
||||
info("Test possible listener mixup");
|
||||
|
|
Загрузка…
Ссылка в новой задаче