Skip to content

Commit 5e50486

Browse files
committed
test: cover legacy menu item element handle
1 parent 31ea25a commit 5e50486

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/Menu.spec.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,13 @@ describe('Menu', () => {
442442
jest.runAllTimers();
443443
});
444444

445-
fireEvent.click(container.querySelector('.rc-menu-item'));
445+
const firstItem = container.querySelector('.rc-menu-item') as HTMLLIElement;
446+
fireEvent.click(firstItem);
446447
const info = handleClick.mock.calls[0][0];
447-
const legacyItem = info.item as unknown as { props: { eventKey?: string } };
448448
expect(info.key).toBe('1');
449-
expect(legacyItem).toBeTruthy();
450-
expect(legacyItem.props.eventKey).toBe('1');
449+
expect(info.item).toBeTruthy();
450+
expect(info.item.props.eventKey).toBe('1');
451+
expect(info.item.element).toBe(firstItem);
451452

452453
expect(errorSpy).toHaveBeenCalledWith(
453454
'Warning: `info.item` is deprecated since we will move to function component that not provides React Node instance in future.',

0 commit comments

Comments
 (0)