//in my component i have
{this.props.auth.isLoadding &&
<p className='text-info positionMessage'>Is registring...</p>
}
//in my test i have
it('should start a new component with set props', () => {
const props = {
auth: {
isAuth: false,
isLoadding: false
}
}
const wrapper = shallow(<ScreensCreateAccount {...props}/>)
wrapper.setProps({isLoadding: true})
//here is code for testing if <p>...</p> appeared. how can i do this?
})
Run Code Online (Sandbox Code Playgroud)
我的组件以开头this.props.auth.isLoadding = false
,当将其更改为true时,html也随之更改,添加<p className='text-info positionMessage'>Is registring...</p>
。我如何使用酶的浅层测试呢?