Shadcn/ui Tabs not switching content in React Testing Library test
10:25 22 Apr 2026

I'm trying to programmatically switch tabs in a Shadcn/ui Tabs component in a React Jest test, but the tab content doesn't update as expected.

In my test, I simulate a click on a tab trigger:

fireEvent.click(screen.getByText("Next Tab"));

but when I assert that the corresponding is rendered, the test fails, saying the content cannot be found.

How do I switch Shadcn tabs in a test so that the correct tab content is rendered properly?

shadcnui