[improvement] Uploader: support preview network image (#3899)

This commit is contained in:
neverland
2019-07-19 11:15:10 +08:00
committed by GitHub
parent 0d68c628ca
commit d0fbaf7325
10 changed files with 181 additions and 82 deletions

View File

@@ -0,0 +1,14 @@
import { isImageFile } from '../utils';
test('isImageFile', () => {
expect(isImageFile({ url: 'https://a.jpg' })).toBeTruthy();
expect(isImageFile({ url: 'https://a.jpeg' })).toBeTruthy();
expect(isImageFile({ url: 'https://a.png' })).toBeTruthy();
expect(isImageFile({ url: 'https://a.svg' })).toBeTruthy();
expect(isImageFile({ url: 'https://a.gif' })).toBeTruthy();
expect(isImageFile({ file: { type: 'image/jpg' } })).toBeTruthy();
expect(isImageFile({ file: { type: 'application/pdf' } })).toBeFalsy();
expect(isImageFile({ content: 'data:image/xxx' })).toBeTruthy();
expect(isImageFile({ content: 'data:application/xxx' })).toBeFalsy();
expect(isImageFile({})).toBeFalsy();
});