File tree Expand file tree Collapse file tree 1 file changed +25
-12
lines changed
packages/enzyme-test-suite/test Expand file tree Collapse file tree 1 file changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -1133,11 +1133,29 @@ describe('shallow', () => {
11331133 ) ;
11341134
11351135 const wrapper = shallow ( < Foo /> ) ;
1136- expect ( wrapper . find ( 'Portal' ) . debug ( ) ) . to . equal ( `<Portal containerInfo={{...}}>
1137- <div className="in-portal">
1138- InPortal
1139- </div>
1140- </Portal>` ) ;
1136+
1137+ expect ( wrapper . find ( 'Portal' ) ) . to . have . lengthOf ( 1 ) ;
1138+ } ) ;
1139+
1140+ itIf ( is ( '>= 16' ) , 'should find elements through portals' , ( ) => {
1141+ const Foo = ( ) => (
1142+ < div >
1143+ { createPortal (
1144+ < div >
1145+ < h1 > Successful Portal!</ h1 >
1146+ < span />
1147+ </ div > ,
1148+ { nodeType : 1 } ,
1149+ ) }
1150+ </ div >
1151+ ) ;
1152+
1153+
1154+ const wrapper = shallow ( < Foo /> ) ;
1155+
1156+ expect ( wrapper . find ( 'h1' ) ) . to . have . lengthOf ( 1 ) ;
1157+
1158+ expect ( wrapper . find ( 'span' ) ) . to . have . lengthOf ( 1 ) ;
11411159 } ) ;
11421160 } ) ;
11431161
@@ -1445,13 +1463,8 @@ describe('shallow', () => {
14451463 ) ;
14461464
14471465 const wrapper = shallow ( < Foo /> ) ;
1448- const portal = wrapper . findWhere ( node => node . type ( ) === Portal ) ;
1449- expect ( portal . debug ( ) )
1450- . to . equal ( `<Portal containerInfo={{...}}>
1451- <div className="in-portal">
1452- InPortal
1453- </div>
1454- </Portal>` ) ;
1466+
1467+ expect ( wrapper . findWhere ( node => node . type ( ) === Portal ) ) . to . have . lengthOf ( 1 ) ;
14551468 } ) ;
14561469 } ) ;
14571470
You can’t perform that action at this time.
0 commit comments