-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding default value of porps size on module Avatar and some test cases.
- Loading branch information
1 parent
3eb889b
commit b24b5fe
Showing
2 changed files
with
30 additions
and
0 deletions.
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,29 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import Avatar from '../'; | ||
|
||
describe('<Avatar>', () => { | ||
const Component = mount(<Avatar />); | ||
|
||
it('The name of module must be Avatar', () => { | ||
expect(Component.name()).toBe('Avatar'); | ||
}) | ||
|
||
it('The type of props "type" should be string', () => { | ||
Component.setProps({ icon: 'user' }) | ||
expect(typeof Component.prop('icon')).toEqual('string'); | ||
}) | ||
|
||
it('The type of props "type" should be "Element"', () => { | ||
Component.setProps({ icon: <div>This is a Dom Element</div> }) | ||
expect(Component.prop('icon').type).toEqual('div') | ||
}) | ||
|
||
it('The value of props "size" must be one of ["large", "default", "small"]', () => { | ||
expect(["large", "default", "small"]).toContain(Component.prop('size')) | ||
}) | ||
|
||
it('The value of props "shape" must be one of ["square","circle"]', () => { | ||
expect(["square", "circle"]).toContain(Component.prop('shape')) | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -59,4 +59,5 @@ Avatar.propTypes = { | |
Avatar.defaultProps = { | ||
prefixCls: 'w-avatar', | ||
shape: 'circle', | ||
size: 'default' | ||
} |