|
|
@ -90,4 +90,20 @@ describe('Anchor Render', () => { |
|
|
|
wrapper.setProps({ children: null }); |
|
|
|
expect(wrapper.instance().links).toEqual([]); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should update links when link href update', async () => { |
|
|
|
let anchorInstance = null; |
|
|
|
function AnchorUpdate({ href }) { |
|
|
|
return ( |
|
|
|
<Anchor ref={c => anchorInstance = c}> |
|
|
|
<Link href={href} title="API" /> |
|
|
|
</Anchor> |
|
|
|
); |
|
|
|
} |
|
|
|
const wrapper = mount(<AnchorUpdate href="#API" />); |
|
|
|
|
|
|
|
expect(anchorInstance.links).toEqual(['#API']); |
|
|
|
wrapper.setProps({ href: '#API_1' }); |
|
|
|
expect(anchorInstance.links).toEqual(['#API_1']); |
|
|
|
}); |
|
|
|
}); |
|
|
|