Skip to content

Commit

Permalink
test(Nav): add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Aug 15, 2019
1 parent fef80cd commit 2c94f68
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/nav/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,25 @@ describe('Nav', () => {
assert(wrapper.find('li.next-nav-group-label').length === 1);
});

it('should support defaultSelectedKeys undefined/null', () => {
wrapper = mount(
<Nav defaultSelectedKeys={null}>
<SubNav label="Group label">
<Item key="1">First</Item>
<Item key="2">Second</Item>
</SubNav>
</Nav>
);

});

it('should support showChildSelected', () => {
wrapper = mount(
<Nav showChildSelected selectedKeys="1" />
<Nav selectedKeys="1" />
);

assert(wrapper);

wrapper.setProps({
children: <SubNav label="Group label">
<Item key="1">First</Item>
Expand All @@ -230,6 +244,12 @@ describe('Nav', () => {
});

assert(subNavItem.find('.next-nav-item').hasClass('next-child-selected'));

wrapper.setProps({
selectedKeys: 'ddasdfa'
});

assert(wrapper);
});

it('should support iconOnly', done => {
Expand Down

0 comments on commit 2c94f68

Please sign in to comment.