Skip to content

Commit

Permalink
os specific shortcuts test
Browse files Browse the repository at this point in the history
  • Loading branch information
alextaing committed Oct 25, 2023
1 parent 5d01d1f commit 17774a5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/studio-ui/tests/components/UndoRedo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,30 @@ describe("Undo/redo", () => {
expect(useStudioStore.getState().pages.activeComponentUUID).toBeUndefined();
});

it("undoes last state update using control + z if OS is not OS X", async () => {
it("only undoes last state update using control + z if not in OS X", async () => {
platform.os.family = "Windows";
render(<UndoRedo />);
expect(useStudioStore.getState().pages.activeComponentUUID).toBe(
"searchbar-uuid"
);
await userEvent.keyboard("{Meta>}z{/Meta}");
expect(useStudioStore.getState().pages.activeComponentUUID).toBe(
"searchbar-uuid"
);
await userEvent.keyboard("{Control>}z{/Control}");
expect(useStudioStore.getState().pages.activeComponentUUID).toBeUndefined();
});

it("undoes last state update using command + z is OS is OS X", async () => {
it("only undoes last state update using command + z if in OS X", async () => {
platform.os.family = "OS X";
render(<UndoRedo />);
expect(useStudioStore.getState().pages.activeComponentUUID).toBe(
"searchbar-uuid"
);
await userEvent.keyboard("{Control>}z{/Control}");
expect(useStudioStore.getState().pages.activeComponentUUID).toBe(
"searchbar-uuid"
);
await userEvent.keyboard("{Meta>}z{/Meta}");
expect(useStudioStore.getState().pages.activeComponentUUID).toBeUndefined();
});
Expand Down

0 comments on commit 17774a5

Please sign in to comment.