We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1b78ca commit 783a9e7Copy full SHA for 783a9e7
tests/SubMenu.test.js
@@ -42,4 +42,19 @@ describe('<SubMenu/>', () => {
42
await user.hover(wrapper);
43
await expect(() => waitForMenuVisible(submenu)).rejects.toThrow();
44
});
45
+
46
+ it('should not crash after immediate unmount', async () => {
47
+ let callback = null;
48
+ jest.spyOn(window, 'requestAnimationFrame').mockImplementation((cb) => {
49
+ callback = cb;
50
+ return 1;
51
+ });
52
+ const { unmount } = render(<SubMenu title='Title' hoverDelay={0} />);
53
+ const user = userEvent.setup();
54
+ const wrapper = screen.getByText('Title');
55
+ await user.hover(wrapper);
56
+ unmount();
57
58
+ expect(callback).not.toThrow();
59
60
0 commit comments