summaryrefslogtreecommitdiff
path: root/test/hotkey-util.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/hotkey-util.test.js')
-rw-r--r--test/hotkey-util.test.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/hotkey-util.test.js b/test/hotkey-util.test.js
index 8666b98b..02622c40 100644
--- a/test/hotkey-util.test.js
+++ b/test/hotkey-util.test.js
@@ -19,8 +19,10 @@
import {expect, test} from 'vitest';
import {HotkeyUtil} from '../ext/js/input/hotkey-util.js';
+/** */
function testCommandConversions() {
test('CommandConversions', () => {
+ /** @type {{os: import('environment').OperatingSystem, command: string, expectedCommand: string, expectedInput: {key: string, modifiers: import('input').Modifier[]}}[]} */
const data = [
{os: 'win', command: 'Alt+F', expectedCommand: 'Alt+F', expectedInput: {key: 'KeyF', modifiers: ['alt']}},
{os: 'win', command: 'F1', expectedCommand: 'F1', expectedInput: {key: 'F1', modifiers: []}},
@@ -49,8 +51,10 @@ function testCommandConversions() {
});
}
+/** */
function testDisplayNames() {
test('DisplayNames', () => {
+ /** @type {{os: import('environment').OperatingSystem, key: ?string, modifiers: import('input').Modifier[], expected: string}[]} */
const data = [
{os: 'win', key: null, modifiers: [], expected: ''},
{os: 'win', key: 'KeyF', modifiers: [], expected: 'F'},
@@ -138,8 +142,10 @@ function testDisplayNames() {
});
}
+/** */
function testSortModifiers() {
test('SortModifiers', () => {
+ /** @type {{modifiers: import('input').Modifier[], expected: import('input').Modifier[]}[]} */
const data = [
{modifiers: [], expected: []},
{modifiers: ['shift', 'alt', 'ctrl', 'mouse4', 'meta', 'mouse1', 'mouse0'], expected: ['meta', 'ctrl', 'alt', 'shift', 'mouse0', 'mouse1', 'mouse4']}
@@ -155,6 +161,7 @@ function testSortModifiers() {
}
+/** */
function main() {
testCommandConversions();
testDisplayNames();