File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 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
2828fireEvent . select = ( node , init ) => {
2929 select ( node , init )
3030 // React tracks this event only on focused inputs
31+ // TODO probably need to fire focusin for JSDOM compat
3132 node . focus ( )
3233
3334 // React creates this event when one of the following native events happens
@@ -41,4 +42,18 @@ fireEvent.select = (node, init) => {
4142 fireEvent . keyUp ( node , init )
4243}
4344
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+
4459export { fireEvent }
You can’t perform that action at this time.
0 commit comments