TypesOfFruit和Fruits 。取TypesOfFruit组分和构成它,或者它窝 ,所述内Fruits组分。然后使用Fruits组件并将其嵌套在TypesOfFood组件中。结果应该是一个嵌套在父组件中的子组件,它嵌套在它自己的父组件中! TypesOfFood组件应返回单个div元素。
testString: 'assert(Enzyme.shallow(React.createElement(TypesOfFood)).type() === "div", "The TypesOfFood component should return a single div element.");'
- text: TypesOfFood组件应返回Fruits组件。
testString: 'assert(Enzyme.shallow(React.createElement(TypesOfFood)).props().children[1].type.name === "Fruits", "The TypesOfFood component should return the Fruits component.");'
- text: Fruits组件应返回TypesOfFruit组件。
testString: 'assert(Enzyme.mount(React.createElement(TypesOfFood)).find("h2").html() === "Fruits component should return the TypesOfFruit component.");'
- text: TypesOfFruit组件应返回h2和ul元素。
testString: 'assert(Enzyme.mount(React.createElement(TypesOfFood)).find("ul").text() === "ApplesBlueberriesStrawberriesBananas", "The TypesOfFruit component should return the h2 and ul elements.");'
```