this ключевое слово. Чтобы получить доступ к реквизиту в компоненте класса, вы предварить код, используемый для доступа к нему с this . Например, если компонент класса ES6 имеет опору называют data , вы пишете {this.props.data} в JSX. ReturnTempPassword компонента ReturnTempPassword в родительском компоненте ResetPassword . Здесь дайте ReturnTempPassword tempPassword и присвойте ему значение строки длиной не менее 8 символов. Внутри дочернего ReturnTempPassword к поддержке tempPassword в strong тегах, чтобы убедиться, что пользователь видит временный пароль. ResetPassword должен возвращать один элемент div .
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ResetPassword)); return mockedComponent.children().type() === "div"; })(), "The ResetPassword component should return a single div element.");'
- text: ''
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ResetPassword)); return mockedComponent.children().childAt(3).name() === "ReturnTempPassword"; })(), "The fourth child of ResetPassword should be the ReturnTempPassword component.");'
- text: ''
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ResetPassword)); return mockedComponent.find("ReturnTempPassword").props().tempPassword; })(), "The ReturnTempPassword component should have a prop called tempPassword.");'
- text: ''
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ResetPassword)); const temp = mockedComponent.find("ReturnTempPassword").props().tempPassword; return typeof temp === "string" && temp.length >= 8; })(), "The tempPassword prop of ReturnTempPassword should be equal to a string of at least 8 characters.");'
- text: ''
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ResetPassword)); return mockedComponent.find("strong").text() === mockedComponent.find("ReturnTempPassword").props().tempPassword; })(), "The ReturnTempPassword component should display the password you create as the tempPassword prop within strong tags.");'
```
Your temporary password is:
{ /* change code above this line */ }