ShoppingCart
agora renderiza um Items
filho. Esse componente Items
tem uma quantity
prop padrão definida para o inteiro 0
. Substitua o prop padrão, passando um valor de 10
para quantity
. Nota: Lembre - se de que a sintaxe para adicionar um suporte a um componente é semelhante à forma como você adiciona atributos HTML. No entanto, como o valor da quantity
é um número inteiro, ele não será colocado entre aspas, mas deverá ser colocado em chaves. Por exemplo, {100}
. Essa sintaxe diz ao JSX para interpretar o valor dentro das chaves diretamente como JavaScript. ShoppingCart
deve renderizar.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("ShoppingCart").length === 1; })(), "The component ShoppingCart
should render.");'
- text: Os Items
componentes devem renderizar.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("Items").length === 1; })(), "The component Items
should render.");'
- text: 'O componente Items
deve ter um prop de { quantity: 10 }
passado do componente ShoppingCart
.'
testString: 'getUserInput => assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("Items").props().quantity == 10 && getUserInput("index").replace(/ /g,"").includes("Items
component should have a prop of { quantity: 10 }
passed from the ShoppingCart
component.");'
```