Browse Source

Fix sample test code (#2648)

main
numb86 5 years ago
committed by Sophie Alpert
parent
commit
1e4159d11d
  1. 4
      content/docs/testing-recipes.md

4
content/docs/testing-recipes.md

@ -396,14 +396,14 @@ it("changes value when clicked", () => {
// get ahold of the button element, and trigger some clicks on it
const button = document.querySelector("[data-testid=toggle]");
expect(button.innerHTML).toBe("Turn off");
expect(button.innerHTML).toBe("Turn on");
act(() => {
button.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
expect(onChange).toHaveBeenCalledTimes(1);
expect(button.innerHTML).toBe("Turn on");
expect(button.innerHTML).toBe("Turn off");
act(() => {
for (let i = 0; i < 5; i++) {

Loading…
Cancel
Save