Skip to content

Commit

Permalink
test(input): missing act wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
Peterl561 committed Jan 17, 2025
1 parent b02e809 commit 8236cc1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/components/input/__tests__/input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ describe("Input", () => {

const {container} = render(<Input label="test input" onFocus={onFocus} />);

container.querySelector("input")?.focus();
container.querySelector("input")?.blur();
act(() => {
container.querySelector("input")?.focus();
});
act(() => {
container.querySelector("input")?.blur();
});

expect(onFocus).toHaveBeenCalledTimes(1);
});
Expand Down Expand Up @@ -203,7 +207,7 @@ describe("Input", () => {
it("ref should update the value", () => {
const ref = React.createRef<HTMLInputElement>();

const {container} = render(<Input ref={ref} type="text" />);
render(<Input ref={ref} type="text" />);

if (!ref.current) {
throw new Error("ref is null");
Expand All @@ -212,8 +216,6 @@ describe("Input", () => {

ref.current!.value = value;

container.querySelector("input")?.focus();

expect(ref.current?.value)?.toBe(value);
});

Expand Down

0 comments on commit 8236cc1

Please sign in to comment.