File tree Expand file tree Collapse file tree
packages/enzyme-test-suite/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3500,6 +3500,35 @@ describeWithDOM('mount', () => {
35003500 expect ( bar ) . to . have . lengthOf ( 1 ) ;
35013501 expect ( bar . parents ( '.root' ) ) . to . have . lengthOf ( 1 ) ;
35023502 } ) ;
3503+
3504+ it ( 'finds parents up a tree through a custom component boundary' , ( ) => {
3505+ class CustomForm extends React . Component {
3506+ render ( ) {
3507+ const { children } = this . props ;
3508+ return (
3509+ < form >
3510+ { children }
3511+ </ form >
3512+ ) ;
3513+ }
3514+ }
3515+
3516+ const wrapper = mount ( (
3517+ < div >
3518+ < CustomForm >
3519+ < input />
3520+ </ CustomForm >
3521+ </ div >
3522+ ) ) ;
3523+
3524+ const formDown = wrapper . find ( 'form' ) ;
3525+ expect ( formDown ) . to . have . lengthOf ( 1 ) ;
3526+
3527+ const input = wrapper . find ( 'input' ) ;
3528+ expect ( input ) . to . have . lengthOf ( 1 ) ;
3529+ const formUp = input . parents ( 'form' ) ;
3530+ expect ( formUp ) . to . have . lengthOf ( 1 ) ;
3531+ } ) ;
35033532 } ) ;
35043533
35053534 describe ( '.parent()' , ( ) => {
You can’t perform that action at this time.
0 commit comments