Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yoonieaj committed Nov 29, 2024
1 parent 295509b commit d47b007
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions webstepper/src/__tests__/App.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,16 @@ describe("App", () => {
expect(firstLineElement).not.toHaveClass("code-box__line--highlighted");
expect(secondLineElement).toHaveClass("code-box__line--highlighted");
});

it("updates step when arrow keys are pressed", () => {
const maxStep = getMaxStep();
fireEvent.keyDown(document, { key: "ArrowRight" });

expect(screen.getByText(`Step 2/${maxStep}`)).toBeInTheDocument();

// Then go back
fireEvent.keyDown(document, { key: "ArrowLeft" });

expect(screen.getByText(`Step 1/${maxStep}`)).toBeInTheDocument();
});
});

0 comments on commit d47b007

Please sign in to comment.