Skip to content

Commit

Permalink
Reassigned shortcut keys for browser compatibility. (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckAMayzing authored and Raathigesh committed May 31, 2019
1 parent 1b66be0 commit 8aa9208
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ You can configure Majestic by adding `majestic` key to `package.json`.

### Shortcut keys

`ctrl+t` - run all tests
`alt+t` - run all tests

`ctrl+enter` - run selected file
`alt+enter` - run selected file

`ctrl+w` - watch
`alt+w` - watch

`ctrl+s` - search
`alt+s` - search

`escape` - close search

Expand Down
2 changes: 1 addition & 1 deletion ui/hooks/use-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function hasKeys(expectedKeys: string[], pressedKeys: Map<String, boolean

export default function useKeys() {
const [keys, setKeys] = useState(new Map());
const hotKeys = ["Control", "Enter", "Escape", "s", "t", "w"];
const hotKeys = ["Alt", "Enter", "Escape", "s", "t", "w"];

function downHandler({ key }:KeyboardEvent) {
// only update state for keys we are watching
Expand Down
6 changes: 3 additions & 3 deletions ui/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ export default function TestExplorer({

const isRunning = runnerStatus && runnerStatus.running;
const keys = useKeys();
if (hasKeys(["Control", "t"], keys)) {
if (hasKeys(["Alt", "t"], keys)) {
run();
} else if (hasKeys(["Control", "w"], keys)) {
} else if (hasKeys(["Alt", "w"], keys)) {
if (runnerStatus) {
handleSetWatchModel(!runnerStatus.watching);
}
} else if (hasKeys(["Control", "s"], keys)) {
} else if (hasKeys(["Alt", "s"], keys)) {
onSearchOpen();
}

Expand Down
2 changes: 1 addition & 1 deletion ui/test-file/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function TestFile({ selectedFilePath, isRunning, projectRoot, onStop }: Props) {
item => item.parent === null
);
const keys = useKeys();
if (hasKeys(["Control", "Enter"], keys)) {
if (hasKeys(["Alt", "Enter"], keys)) {
runFile();
}
return (
Expand Down

0 comments on commit 8aa9208

Please sign in to comment.