gitlab-org--gitlab-foss/spec/frontend/lib/utils/image_utility_spec.js
2019-03-23 17:53:46 +01:00

32 lines
788 B
JavaScript

import { isImageLoaded } from '~/lib/utils/image_utility';
describe('imageUtility', () => {
describe('isImageLoaded', () => {
it('should return false when image.complete is false', () => {
const element = {
complete: false,
naturalHeight: 100,
};
expect(isImageLoaded(element)).toEqual(false);
});
it('should return false when naturalHeight = 0', () => {
const element = {
complete: true,
naturalHeight: 0,
};
expect(isImageLoaded(element)).toEqual(false);
});
it('should return true when image.complete and naturalHeight != 0', () => {
const element = {
complete: true,
naturalHeight: 100,
};
expect(isImageLoaded(element)).toEqual(true);
});
});
});