Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* fix issue ant-design#8666

* add issue ant-design#8666 test
  • Loading branch information
stonehank authored and yesmeck committed Jun 1, 2018
1 parent 7c27391 commit 5be1b9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/menu/SubMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class SubMenu extends React.Component<any, any> {
static contextTypes = {
antdMenuTheme: PropTypes.string,
};
// fix issue:https://github.com/ant-design/ant-design/issues/8666
static isSubMenu = 1;
private subMenu: any;
onKeyDown = (e: React.MouseEvent<HTMLElement>) => {
this.subMenu.onKeyDown(e);
Expand Down
17 changes: 17 additions & 0 deletions components/menu/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ describe('Menu', () => {
jest.useRealTimers();
});

it('If has select nested submenu item ,the menu items on the grandfather level should be highlight', () => {
const wrapper = mount(
<Menu defaultSelectedKeys={['1-3-2']} mode="vertical">
<SubMenu key="1" title="submenu1">
<Menu.Item key="1-1">Option 1</Menu.Item>
<Menu.Item key="1-2">Option 2</Menu.Item>
<SubMenu key="1-3" title="submenu1-3">
<Menu.Item key="1-3-1">Option 3</Menu.Item>
<Menu.Item key="1-3-2">Option 4</Menu.Item>
</SubMenu>
</SubMenu>
<Menu.Item key="2">menu2</Menu.Item>
</Menu>
);
expect(wrapper.find('.ant-menu-submenu-selected').length).toBe(1);
});

it('should accept defaultOpenKeys in mode horizontal', () => {
const wrapper = mount(
<Menu defaultOpenKeys={['1']} mode="horizontal">
Expand Down

0 comments on commit 5be1b9c

Please sign in to comment.