我有一个组件,我在其中传递了一些道具,这些道具使用渲染道具来渲染组件。如何使此渲染道具变浅并渲染以传递值并检查返回结果。
<FormattedMessage id='rooms'
values={{
link: <FormattedMessage id='rooms.deviceAssignment.title'>
{text =>
link(pathToDeviceAssignment)({children: text})
}
</FormattedMessage>,
}}
/>
it('should render correct notification message', () => {
const notificationMessage = notification.findWhere(x => x.props().id === 'rooms.deviceAssignment.stopListeningMode.notification')
const B = notificationMessage.props().values.link
const wrapper = shallow(<B />)
notificationMessage.should.exist
})