mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
parent
7c273912fd
commit
5be1b9c33c
@ -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);
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user