diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2017-10-07 04:25:17 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2017-10-07 04:25:17 +0000 |
commit | b54203f0ada8f7ad6d24437b6f5f46ebf43f8695 (patch) | |
tree | b903596b4755da406dfd1349a8b2c59a5f38b9d1 /spec/javascripts/lib | |
parent | b4f9dc48163c065d776d120dd312c689ce79f653 (diff) | |
download | gitlab-ce-b54203f0ada8f7ad6d24437b6f5f46ebf43f8695.tar.gz |
Commenting on image diffs
Diffstat (limited to 'spec/javascripts/lib')
-rw-r--r-- | spec/javascripts/lib/utils/image_utility_spec.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/image_utility_spec.js b/spec/javascripts/lib/utils/image_utility_spec.js new file mode 100644 index 00000000000..75addfcc833 --- /dev/null +++ b/spec/javascripts/lib/utils/image_utility_spec.js @@ -0,0 +1,32 @@ +import * as imageUtility 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(imageUtility.isImageLoaded(element)).toEqual(false); + }); + + it('should return false when naturalHeight = 0', () => { + const element = { + complete: true, + naturalHeight: 0, + }; + + expect(imageUtility.isImageLoaded(element)).toEqual(false); + }); + + it('should return true when image.complete and naturalHeight != 0', () => { + const element = { + complete: true, + naturalHeight: 100, + }; + + expect(imageUtility.isImageLoaded(element)).toEqual(true); + }); + }); +}); |