This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add test and storybook for SubMenu. (#62)
- Loading branch information
1 parent
8849a31
commit 49980bf
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import SubMenu from './index'; | ||
import { mount } from 'enzyme'; | ||
|
||
describe('SubMenu', () => { | ||
it('render simple SubMenu', () => { | ||
const subMenu = mount(<SubMenu title="title" children="text" />); | ||
expect(subMenu.find('ul.dropdown-menu').length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { SubMenu } from '../src'; | ||
|
||
const menuStyle = { | ||
width: '100px', | ||
}; | ||
const title = '第一层'; | ||
const children = <div style={{ padding: '4px' }}>下一层</div>; | ||
storiesOf('SubMenu', module) | ||
.add('default', () => ( | ||
<div> | ||
<div style={menuStyle}> | ||
<SubMenu title={title}>{children}</SubMenu> | ||
</div> | ||
</div> | ||
)); |