@@ -34,11 +34,6 @@ describe('When I create the VueImageKit component', () => {
3434 return shallowMount ( VueImageKit , { propsData } )
3535 }
3636
37- it ( 'should be a Vue instance' , ( ) => {
38- const wrapper = createComponent ( item )
39- expect ( wrapper . find ( VueImageKit ) . isVueInstance ( ) ) . toBe ( true )
40- } )
41-
4237 it ( 'should validate all props' , ( ) => {
4338 const consoleLog = console . error
4439 console . error = jest . fn ( )
@@ -88,6 +83,10 @@ describe('When I create the VueImageKit component', () => {
8883 expect ( alt . required ) . toBeFalsy ( )
8984 expect ( alt . type ) . toBe ( String )
9085 expect ( alt . default ) . toBe ( '' )
86+ const lazyLoad = wrapper . vm . $options . props . lazyLoad
87+ expect ( lazyLoad . required ) . toBeFalsy ( )
88+ expect ( lazyLoad . type ) . toBe ( Boolean )
89+ expect ( lazyLoad . default ) . toBe ( true )
9190 const component = wrapper . find ( '.vue-image-kit' )
9291 expect ( component . exists ( ) ) . toBe ( true )
9392 console . error = consoleLog
@@ -161,6 +160,17 @@ describe('When I create the VueImageKit component', () => {
161160 expect ( main . attributes ( ) . sizes ) . toContain ( '1366px' )
162161 } )
163162
163+ it ( 'should not have lazy load' , ( ) => {
164+ const wrapper = createComponent ( { ...item , lazyLoad : false } )
165+ const main = wrapper . find ( '.vue-image-kit' )
166+ expect ( main . exists ( ) ) . toBe ( true )
167+ expect ( main . classes ( ) ) . toContain ( 'vue-image-kit--loaded' )
168+ const placeholder = wrapper . find ( '.vue-image-kit__placeholder' )
169+ expect ( placeholder . exists ( ) ) . toBe ( false )
170+ expect ( wrapper . vm . showCanvas ) . toBe ( false )
171+ expect ( wrapper . vm . $refs . normalLoad ) . toBeInstanceOf ( HTMLImageElement )
172+ } )
173+
164174 it ( 'should have a custom transform' , async ( ) => {
165175 // https://imagekit.io/features/advanced-image-manipulation-blur-rotate-crop-background-radius
166176 const customTransform = 'c-at_max,bl-1:r-20,bg-FFCFA1'
0 commit comments