File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 1212 matrix :
1313 - TEST_TYPE=lint
1414 - TEST_TYPE=test
15- - TEST_TYPE=coverage
15+ - TEST_TYPE=coverage
16+
17+ after_success :
18+ - bash <(curl -s https://codecov.io/bash) -e TRAVIS_NODE_VERSION
Original file line number Diff line number Diff line change 3737 "pub" : " rc-tools run pub --babel-runtime" ,
3838 "lint" : " rc-tools run lint" ,
3939 "test" : " jest" ,
40- "coverage" : " jest --coverage && curl -s https://codecov.io/bash " ,
40+ "coverage" : " jest --coverage" ,
4141 "prepublish" : " rc-tools run guard"
4242 },
4343 "jest" : {
Original file line number Diff line number Diff line change @@ -21,6 +21,26 @@ describe('rc-checkbox', () => {
2121 expect ( wrapper . state ( 'checked' ) ) . toBe ( true ) ;
2222 } ) ;
2323
24+ it ( 'control mode' , ( ) => {
25+ const wrapper = mount ( < Checkbox checked /> ) ;
26+ expect ( wrapper . state ( 'checked' ) ) . toBe ( true ) ;
27+ wrapper . find ( 'input' ) . simulate ( 'change' , { target : { checked : true } } ) ;
28+ expect ( wrapper . state ( 'checked' ) ) . toBe ( true ) ;
29+ wrapper . find ( 'input' ) . simulate ( 'change' , { target : { checked : false } } ) ;
30+ expect ( wrapper . state ( 'checked' ) ) . toBe ( true ) ;
31+ } ) ;
32+
33+ it ( 'stopPropagation and preventDefault' , ( ) => {
34+ const onChange = jest . fn ( ) ;
35+ const wrapper = mount (
36+ < div onChange = { onChange } >
37+ < Checkbox onChange = { e => { e . stopPropagation ( ) ; e . preventDefault ( ) ; } } />
38+ </ div >
39+ ) ;
40+ wrapper . find ( 'input' ) . simulate ( 'change' , { target : { checked : true } } ) ;
41+ expect ( onChange ) . not . toHaveBeenCalled ( ) ;
42+ } ) ;
43+
2444 it ( 'passes data-* props to input' , ( ) => {
2545 const wrapper = mount ( < Checkbox data-type = "my-data-type" /> ) ;
2646 const renderedInput = wrapper . find ( 'input' ) . instance ( ) ;
You can’t perform that action at this time.
0 commit comments