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.");'
```