2017-04-07 2 views
0

엔자임 얕은 렌더러에 문제가 있습니다. 내 wrapper.root.node 간단한 div 요소에도 나를 null을 반환합니다.엔자임 얕은 렌더러가 null 노드 요소를 반환합니다.

 const wrapper = shallow(
      <div>asd</div> 
     ); 

그리고 여기에 ShallowWrapper 개체가 있습니다. 노드 요소는 null이지만 렌더링되지 않은 속성에는 일반 렌더링 된 객체가 포함됩니다. 왜 그런가요?

ShallowWrapper { 
    "complexSelector": ComplexSelector { 
    "buildPredicate": [Function], 
    "childrenOfNode": [Function], 
    "findWhereUnwrapped": [Function], 
    }, 
    "length": 1, 
    "node": null, 
    "nodes": Array [ 
    null, 
    ], 
    "options": Object {}, 
    "renderer": ReactShallowRenderer { 
    "_instance": null, 
    "getRenderOutput": [Function], 
    "render": [Function], 
    }, 
    "root": [Circular], 
    "unrendered": <div> 
    asd 
</div>, 
} 

답변

0

좋아, 농담에 의해 야기되는 문제 "반응 - DOM을 '거짓 기타 파일에 테스트 유닛을 이동시킴으로써 해결

jest.mock('react-dom') 

문제.

관련 문제