File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ const ModalTrigger = React.createClass({
54
54
props . onClick = createChainedFunction ( child . props . onClick , this . toggle ) ;
55
55
props . onMouseOver = createChainedFunction ( child . props . onMouseOver , this . props . onMouseOver ) ;
56
56
props . onMouseOut = createChainedFunction ( child . props . onMouseOut , this . props . onMouseOut ) ;
57
+ props . onFocus = createChainedFunction ( child . props . onFocus , this . props . onFocus ) ;
58
+ props . onBlur = createChainedFunction ( child . props . onBlur , this . props . onBlur ) ;
57
59
58
60
return cloneElement ( child , props ) ;
59
61
}
Original file line number Diff line number Diff line change @@ -42,4 +42,34 @@ describe('ModalTrigger', function() {
42
42
ReactTestUtils . Simulate . mouseOut ( modalTrigger ) ;
43
43
assert . equal ( called , true ) ;
44
44
} ) ;
45
+
46
+ it ( 'Should pass ModalTrigger onFocus prop to children' , function ( ) {
47
+ let called = false ;
48
+ let callback = function ( ) {
49
+ called = true ;
50
+ } ;
51
+ let instance = ReactTestUtils . renderIntoDocument (
52
+ < ModalTrigger modal = { < div > test</ div > } onFocus = { callback } >
53
+ < button > button</ button >
54
+ </ ModalTrigger >
55
+ ) ;
56
+ let modalTrigger = instance . getDOMNode ( ) ;
57
+ ReactTestUtils . Simulate . focus ( modalTrigger ) ;
58
+ assert . equal ( called , true ) ;
59
+ } ) ;
60
+
61
+ it ( 'Should pass ModalTrigger onBlur prop to children' , function ( ) {
62
+ let called = false ;
63
+ let callback = function ( ) {
64
+ called = true ;
65
+ } ;
66
+ let instance = ReactTestUtils . renderIntoDocument (
67
+ < ModalTrigger modal = { < div > test</ div > } onBlur = { callback } >
68
+ < button > button</ button >
69
+ </ ModalTrigger >
70
+ ) ;
71
+ let modalTrigger = instance . getDOMNode ( ) ;
72
+ ReactTestUtils . Simulate . blur ( modalTrigger ) ;
73
+ assert . equal ( called , true ) ;
74
+ } ) ;
45
75
} ) ;
You can’t perform that action at this time.
0 commit comments