1
在分量I具有以下div的渲染部分:發送道具到陣營組件,其用於一玩笑單元測試
<div className="col-sm-8" >
<input ref='full_link' className="formctrl" name='full_link' type='text'
value={browser.getURL(this.props.params.id)} />
</div>
要爲該組件寫一個測試單元,我試圖淺使其( const component = shallow(<myComponent />);
)並返回該錯誤:
TypeError: Cannot read property 'id' of undefined
所以我需要在測試這個道具發送到我的組件。我應該如何將id
從this.props.params.id
發送到淺層渲染?
謝謝法比奧:) – Birish