React Enzyme find second (or nth) node

后端 未结 3 1187
礼貌的吻别
礼貌的吻别 2021-01-30 11:58

I\'m testing a React component with Jasmine Enzyme shallow rendering.

Simplified here for the purposes of this question...

function MyOuterComponent() {
         


        
3条回答
  •  长情又很酷
    2021-01-30 12:34

     const component = wrapper.find('MyInnerComponent').at(1); 
     //at(1) index of element 0 to ~
    
     expect(component.prop('title')).to.equal('Good-bye');
    

提交回复
热议问题