test: add menu focus test (#35252)

This commit is contained in:
MadCcc 2022-04-26 18:17:55 +08:00 committed by GitHub
parent 8a36abcc17
commit 42525ffbdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -940,14 +940,16 @@ describe('Menu', () => {
it('should support ref', async () => {
const ref = React.createRef();
const wrapper = mount(
const { container } = render(
<Menu ref={ref}>
<SubMenu key="sub1" title="Navigation One">
<Menu.Item key="1">Option 1</Menu.Item>
</SubMenu>
</Menu>,
);
expect(ref.current?.menu?.list).toBe(wrapper.find('ul').first().getDOMNode());
expect(ref.current?.menu?.list).toBe(container.querySelector('ul'));
ref.current?.focus();
expect(document.activeElement).toBe(container.querySelector('ul'));
});
it('expandIcon', () => {