Replies: 1 comment
-
thanks to @who-knows-who, who investigate the source code. It turns out we need send both https://github.com/saad-learns/flexdemo/blob/solution/src/FlexDemo.test.js describe('Demo', () => {
it('should switch tab when clicking tab title', async () => {
render(<FlexDemo />);
expect(screen.queryByText('Panel Three')).toBe(null);
const tab = screen.getByText('Three');
fireEvent.mouseDown(tab);
fireEvent.mouseUp(tab);
expect(screen.getByText('Panel Three')).toBeVisible();
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying out flexlayout from the demo application. It is the same example as shown in the demo (from JSFiddle). Here is the full application code: https://github.com/saad-learns/flexdemo
I wanted to test out the behavior with testing-library. But I can't seem to fire the "click" event on the tab.
https://github.com/saad-learns/flexdemo/blob/main/src/FlexDemo.test.js
the last expect does not pass. The fireevent does not seem to click the tab to switch to "Panel Three" tab content. (try it with
npm run test
)But, similar test with cypress works:
https://github.com/saad-learns/flexdemo/blob/main/src/FlexDemo.cy.jsx
(try it with
npx cypress run --component
ornpx cypress open --component
where you can also verify that the click does click on the tab)thanks and any advice will be greately appreciated.
Beta Was this translation helpful? Give feedback.
All reactions