mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 06:43:16 +08:00
pref: call setProps rathor than componentDidUpdate
This commit is contained in:
parent
64b6197441
commit
cc8d8b05aa
@ -131,10 +131,10 @@ describe('Affix Render', () => {
|
||||
it('updatePosition when target changed', () => {
|
||||
const container = '<div id="mounter" />';
|
||||
const getTarget = () => container;
|
||||
wrapper = mount(<Affix target={getTarget} />).instance();
|
||||
wrapper.componentDidUpdate({ target: null });
|
||||
expect(wrapper.state.status).toBe(0);
|
||||
expect(wrapper.state.affixStyle).toBe(undefined);
|
||||
expect(wrapper.state.placeholderStyle).toBe(undefined);
|
||||
wrapper = mount(<Affix target={getTarget} />);
|
||||
wrapper.setProps({ target: null });
|
||||
expect(wrapper.instance().state.status).toBe(0);
|
||||
expect(wrapper.instance().state.affixStyle).toBe(undefined);
|
||||
expect(wrapper.instance().state.placeholderStyle).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user