mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
Add regression test for external image preview loading
This commit is contained in:
parent
a0b29a664a
commit
930589fd4b
1 changed files with 20 additions and 0 deletions
|
|
@ -295,4 +295,24 @@ describe('components/FilePreviewModal', () => {
|
|||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should be marked as loaded immediately to avoid infinite loading of external images', () => {
|
||||
|
||||
const externalImageUrl = 'http://localhost:8065/api/v4/image?url=https%3A%2F%2Fexample.com%2Fimage.jpg';
|
||||
|
||||
const fileInfos = [{
|
||||
has_preview_image: false,
|
||||
link: externalImageUrl,
|
||||
extension: '',
|
||||
name: 'External Image',
|
||||
}];
|
||||
|
||||
const props = {...baseProps, fileInfos};
|
||||
const wrapper = shallow<FilePreviewModal>(<FilePreviewModal {...props}/>);
|
||||
|
||||
wrapper.instance().loadImage(0);
|
||||
|
||||
expect(wrapper.state('loaded')[0]).toBe(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue