Skip to content

Commit

Permalink
test: input focus error in default expanded accordion item
Browse files Browse the repository at this point in the history
  • Loading branch information
chioio committed Dec 3, 2024
1 parent 514f9b6 commit fd0f585
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/components/accordion/__tests__/accordion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,24 @@ describe("Accordion", () => {

expect(getByRole("separator")).toHaveClass("bg-rose-500");
});

it("should focus input inside default expanded accordion item correctly", async () => {
const wrapper = render(
<Accordion selectedKeys={["1"]}>
<AccordionItem key="1" title="Accordion Item 1">
<Input label="name" type="text" />
</AccordionItem>
</Accordion>,
);

await new Promise((resolve) => setTimeout(resolve, 100));

const input = wrapper.container.querySelector("input");

expect(input).not.toBeNull();

await user.click(input!);

expect(input).toHaveFocus();
});
});

0 comments on commit fd0f585

Please sign in to comment.