File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const select = fireEvent.select
28
28
fireEvent . select = ( node , init ) => {
29
29
select ( node , init )
30
30
// React tracks this event only on focused inputs
31
+ // TODO probably need to fire focusin for JSDOM compat
31
32
node . focus ( )
32
33
33
34
// React creates this event when one of the following native events happens
@@ -41,4 +42,18 @@ fireEvent.select = (node, init) => {
41
42
fireEvent . keyUp ( node , init )
42
43
}
43
44
45
+ // React event system tracks native focusout/focusin events for
46
+ // running blur/focus handlers
47
+ // @link https://github.com/facebook/react/pull/19186
48
+ const blur = fireEvent . blur
49
+ const focus = fireEvent . focus
50
+ fireEvent . blur = ( ...args ) => {
51
+ fireEvent . focusOut ( ...args )
52
+ return blur ( ...args )
53
+ }
54
+ fireEvent . focus = ( ...args ) => {
55
+ fireEvent . focusIn ( ...args )
56
+ return focus ( ...args )
57
+ }
58
+
44
59
export { fireEvent }
You can’t perform that action at this time.
0 commit comments