mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
docs: add image.preview.forceRender props (#37808)
* docs: add image.preview.forceRender props * feat: add test case * feat: edit test case * feat: edit test case * feat: edit test case
This commit is contained in:
parent
da5a3ddacb
commit
77a75c37cd
@ -87,4 +87,21 @@ describe('Image', () => {
|
||||
fireEvent.click(container.querySelector('.ant-image')!);
|
||||
expect(baseElement.querySelector('.container')?.children.length).not.toBe(0);
|
||||
});
|
||||
it('Preview forceRender props', async () => {
|
||||
const onLoadCb = jest.fn();
|
||||
const PreviewImage: React.FC = () => (
|
||||
<Image
|
||||
preview={{
|
||||
visible: false,
|
||||
src,
|
||||
forceRender: true,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
const { baseElement } = render(<PreviewImage />);
|
||||
expect(baseElement.querySelector('.ant-image-preview-root')).not.toBe(null);
|
||||
baseElement.querySelector('.ant-image-preview-img')?.addEventListener('load', onLoadCb);
|
||||
fireEvent.load(baseElement.querySelector('.ant-image-preview-img')!);
|
||||
expect(onLoadCb).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -40,6 +40,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg
|
||||
maskClassName?: string; // v4.11.0
|
||||
current?: number; // v4.12.0 仅支持 PreviewGroup
|
||||
countRender?: (current: number, total: number) => string // v4.20.0 仅支持 PreviewGroup
|
||||
forceRender?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user