debian-mirror-gitlab/spec/frontend/lib/utils/image_utility_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
788 B
JavaScript
Raw Normal View History

2018-10-15 14:42:47 +05:30
import { isImageLoaded } from '~/lib/utils/image_utility';
2018-03-17 18:26:18 +05:30
describe('imageUtility', () => {
describe('isImageLoaded', () => {
it('should return false when image.complete is false', () => {
const element = {
complete: false,
naturalHeight: 100,
};
2018-10-15 14:42:47 +05:30
expect(isImageLoaded(element)).toEqual(false);
2018-03-17 18:26:18 +05:30
});
it('should return false when naturalHeight = 0', () => {
const element = {
complete: true,
naturalHeight: 0,
};
2018-10-15 14:42:47 +05:30
expect(isImageLoaded(element)).toEqual(false);
2018-03-17 18:26:18 +05:30
});
it('should return true when image.complete and naturalHeight != 0', () => {
const element = {
complete: true,
naturalHeight: 100,
};
2018-10-15 14:42:47 +05:30
expect(isImageLoaded(element)).toEqual(true);
2018-03-17 18:26:18 +05:30
});
});
});