mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
test: add menu focus test (#35252)
This commit is contained in:
parent
8a36abcc17
commit
42525ffbdc
@ -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', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user