-
-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: onNextClick, onPrevClick not being called (#2172)
- Loading branch information
Showing
2 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
|
||
import { nextButton, previousButton } from "@/test/elements"; | ||
import { render } from "@/test/render"; | ||
import { user } from "@/test/user"; | ||
|
||
import { Nav } from "./Nav"; | ||
|
||
describe("when clicking the next button", () => { | ||
test("should call the onNextClick callback", async () => { | ||
const onNextClick = jest.fn(); | ||
render(<Nav />, { onNextClick }); | ||
await user.click(nextButton()); | ||
expect(onNextClick).toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
describe("when clicking the previous button", () => { | ||
test("should call the onPrevClick callback", async () => { | ||
const onPrevClick = jest.fn(); | ||
render(<Nav />, { onPrevClick }); | ||
await user.click(previousButton()); | ||
expect(onPrevClick).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters