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