|
|
@ -1,6 +1,7 @@ |
|
|
|
import React from 'react'; |
|
|
|
import { mount } from 'enzyme'; |
|
|
|
import Menu from '..'; |
|
|
|
import Icon from '../../Icon'; |
|
|
|
|
|
|
|
const SubMenu = Menu.SubMenu; |
|
|
|
|
|
|
@ -127,4 +128,31 @@ describe('Menu', () => { |
|
|
|
wrapper.setProps({ mode: 'inline' }); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).not.toBe(true); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should always follow openKeys when mode is switched', () => { |
|
|
|
const wrapper = mount( |
|
|
|
<Menu defaultOpenKeys={['1']} mode="inline"> |
|
|
|
<Menu.Item key="menu1"> |
|
|
|
<Icon type="inbox" /> |
|
|
|
<span>Option</span> |
|
|
|
</Menu.Item> |
|
|
|
<SubMenu key="1" title="submenu1"> |
|
|
|
<Menu.Item key="submenu1"> |
|
|
|
Option |
|
|
|
</Menu.Item> |
|
|
|
<Menu.Item key="submenu2"> |
|
|
|
Option |
|
|
|
</Menu.Item> |
|
|
|
</SubMenu> |
|
|
|
</Menu> |
|
|
|
); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-inline')).toBe(true); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(false); |
|
|
|
wrapper.setProps({ inlineCollapsed: true }); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-vertical')).toBe(true); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(true); |
|
|
|
wrapper.setProps({ inlineCollapsed: false }); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-inline')).toBe(true); |
|
|
|
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(false); |
|
|
|
}); |
|
|
|
}); |
|
|
|