Skip to content

Commit

Permalink
test: add menu focus test (#35252)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Apr 26, 2022
1 parent 8a36abc commit 42525ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/menu/__tests__/index.test.js
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 42525ff

Please sign in to comment.