@@ -14,6 +14,12 @@ describe('src/index', () => {
1414 expect ( wrapper . find ( '.or-input .or-clear-icon' ) . length ) . toBe ( 0 )
1515 } )
1616
17+ it ( 'should render basicly #className' , ( ) => {
18+ wrapper = mount ( < RenderInput className = "hello" /> )
19+ expect ( wrapper . find ( '.or-input' ) . length ) . toBe ( 1 )
20+ expect ( wrapper . find ( '.or-input' ) . hasClass ( 'hello' ) ) . toBe ( true )
21+ } )
22+
1723 it ( 'should render basicly #placeholder' , ( ) => {
1824 wrapper = mount ( < RenderInput placeholder = "name" /> )
1925 expect ( wrapper . find ( '.or-input' ) . length ) . toBe ( 1 )
@@ -22,7 +28,7 @@ describe('src/index', () => {
2228 } )
2329 } )
2430
25- describe ( 'simulate events' , ( ) => {
31+ describe ( 'simulate events #default ' , ( ) => {
2632 let wrapper
2733 it ( 'onchange event' , ( ) => {
2834 wrapper = mount ( < RenderInput /> )
@@ -35,6 +41,19 @@ describe('src/index', () => {
3541 } )
3642 } )
3743
44+ describe ( 'simulate events #numericInput' , ( ) => {
45+ let wrapper
46+ it ( 'onchange event' , ( ) => {
47+ wrapper = mount ( < RenderInput numericInput = { true } /> )
48+ const input = wrapper . find ( '.or-input input' )
49+ input . simulate ( 'change' , { target : { value : '123' } } )
50+ expect ( wrapper . find ( '.or-input input' ) . prop ( 'value' ) ) . toBe ( '123' )
51+ expect ( wrapper . find ( '.or-input .or-clear-icon' ) . hostNodes ( ) . length ) . toBe (
52+ 1
53+ )
54+ } )
55+ } )
56+
3857 describe ( 'simulate clear input events' , ( ) => {
3958 let wrapper
4059 it ( 'onchange event' , ( ) => {
@@ -53,6 +72,7 @@ interface Props {
5372 maxlength ?: number
5473 placeholder ?: string
5574 value ?: string
75+ className ?: string
5676}
5777
5878class RenderInput extends React . Component < Props , { } > {
@@ -64,6 +84,7 @@ class RenderInput extends React.Component<Props, {}> {
6484 return (
6585 < div >
6686 < Input
87+ className = { this . props . className }
6788 value = { this . state . name }
6889 onChange = { this . handleChange }
6990 { ...this . props }
0 commit comments