aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers
diff options
context:
space:
mode:
authorGuillaume Peoc'h <guillaume.peoch@sonarsource.com>2022-05-11 14:28:30 +0200
committersonartech <sonartech@sonarsource.com>2022-05-13 20:02:50 +0000
commitb49e9d58f17abfa9d2824a0a0347cb61ff9b014a (patch)
tree93117c1c42632e74e9e2ec047ba198950686baed /server/sonar-web/src/main/js/helpers
parentd782e04fa04567dcfafd237bc4f10a6c62f13972 (diff)
downloadsonarqube-b49e9d58f17abfa9d2824a0a0347cb61ff9b014a.tar.gz
sonarqube-b49e9d58f17abfa9d2824a0a0347cb61ff9b014a.zip
SONAR-16340 Replace keymaster in Search
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r--server/sonar-web/src/main/js/helpers/keycodes.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/testUtils.ts9
2 files changed, 13 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/helpers/keycodes.ts b/server/sonar-web/src/main/js/helpers/keycodes.ts
index eb3229aebd2..04c3b908fac 100644
--- a/server/sonar-web/src/main/js/helpers/keycodes.ts
+++ b/server/sonar-web/src/main/js/helpers/keycodes.ts
@@ -37,6 +37,11 @@ export enum KeyboardCodes {
}
export enum KeyboardKeys {
+ Escape = 'Escape',
+ UpArrow = 'ArrowUp',
+ DownArrow = 'ArrowDown',
+ Enter = 'Enter',
+ Space = ' ',
Alt = 'Alt',
KeyF = 'f',
KeyA = 'a',
@@ -44,6 +49,5 @@ export enum KeyboardKeys {
KeyI = 'i',
KeyC = 'c',
KeyT = 't',
- Space = ' ',
- Escape = 'Escape'
+ KeyS = 's'
}
diff --git a/server/sonar-web/src/main/js/helpers/testUtils.ts b/server/sonar-web/src/main/js/helpers/testUtils.ts
index e43030383a4..1b1abba7dbe 100644
--- a/server/sonar-web/src/main/js/helpers/testUtils.ts
+++ b/server/sonar-web/src/main/js/helpers/testUtils.ts
@@ -87,10 +87,15 @@ export function keydown(args: { code?: KeyboardCodes; key?: KeyboardKeys }): voi
document.dispatchEvent(event);
}
-export function elementKeydown(element: ShallowWrapper, code: KeyboardCodes): void {
+export function elementKeydown(element: ShallowWrapper, key: KeyboardKeys): void {
const event = {
currentTarget: { element },
- nativeEvent: { code },
+ nativeEvent: {
+ key,
+ stopImmediatePropagation: () => {
+ /* noop */
+ }
+ },
preventDefault() {
/*noop*/
}