vadimdemedes / goodness-squad

4 stars 0 forks source link

Stricter tests for keyboard input detection #2

Open vadimdemedes opened 3 years ago

vadimdemedes commented 3 years ago

Ink's tests for keyboard input could be stricter by checking all properties of key object in useInput hook. Currently they look like this - https://github.com/vadimdemedes/ink/blob/master/test/fixtures/use-input.tsx.

Here's an example change for Escape key:

- if (test === 'escape' && key.escape) {
+ if (test === 'escape' && equals(key, {
+  escape: true,
+  leftArrow: false,
+  rightArrow: false,
+  upArrow: false,
+  downArrow: false,
+   // ... other `key` properties should be `false` too
}))