ShoppingCart
ahora representa un componente secundario Items
. Este componente de Items
tiene una quantity
prop predeterminada establecida en el entero 0
. Anule el prop predeterminado al pasar un valor de 10
por quantity
. Nota: recuerde que la sintaxis para agregar una propuesta a un componente es similar a la forma en que agrega atributos HTML. Sin embargo, dado que el valor para la quantity
es un número entero, no irá entre comillas, pero debería estar entre corchetes. Por ejemplo, {100}
. Esta sintaxis le dice a JSX que interprete el valor entre las llaves directamente como JavaScript. ShoppingCart
debe renderizar.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("ShoppingCart").length === 1; })(), "The component ShoppingCart
should render.");'
- text: Los Items
componente deben hacer.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("Items").length === 1; })(), "The component Items
should render.");'
- text: 'El componente Items
debe tener una propiedad de { quantity: 10 }
aprobada desde el 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.");'
```