Closed tmoutinho closed 2 weeks ago
@tmoutinho
it works for me
describe('Drawer', () => {
beforeEach(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
});
test('drawer open', async () => {
render(<CustomDrawer />);
const button = screen.getByRole('button');
// click button
await act(() => userEvent.click(button));
});
});
Hi,
Is there an example on how you can test opening a Drawer and testing the content of the drawer? Tried several times but the Drawer cannot seem to open, even we an fireEvent.
Thanks