File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 13
13
v-if =" fallbackImageSrcSet"
14
14
class =" fallback"
15
15
title =" Image failed to load"
16
+ decoding =" async"
16
17
:alt =" alt"
17
18
:srcset =" fallbackImageSrcSet"
18
19
/>
31
32
v-if =" prefersDark && darkVariantAttributes"
32
33
v-bind =" darkVariantAttributes"
33
34
ref =" img"
35
+ decoding =" async"
36
+ :loading =" loading"
34
37
:alt =" alt"
35
38
:width =" darkVariantAttributes.width || optimalWidth"
36
39
:height =" (darkVariantAttributes.width || optimalWidth) ? 'auto' : null"
43
46
v-else
44
47
v-bind =" defaultAttributes"
45
48
ref =" img"
49
+ decoding =" async"
50
+ :loading =" loading"
46
51
:alt =" alt"
47
52
:width =" defaultAttributes.width || optimalWidth"
48
53
:height =" (defaultAttributes.width || optimalWidth) ? 'auto' : null"
@@ -129,6 +134,10 @@ export default {
129
134
type: Array ,
130
135
required: true ,
131
136
},
137
+ loading: {
138
+ type: String ,
139
+ default: ' lazy' ,
140
+ },
132
141
},
133
142
methods: {
134
143
handleImageLoadError () {
Original file line number Diff line number Diff line change @@ -185,6 +185,7 @@ describe('Asset', () => {
185
185
expect ( asset . exists ( ) ) . toBe ( true ) ;
186
186
expect ( asset . props ( ) ) . toEqual ( {
187
187
alt : image . alt ,
188
+ loading : "lazy" ,
188
189
variants : image . variants ,
189
190
} ) ;
190
191
} ) ;
@@ -194,6 +195,7 @@ describe('Asset', () => {
194
195
const asset = wrapper . find ( ImageAsset ) ;
195
196
expect ( asset . props ( ) ) . toEqual ( {
196
197
alt : image . alt ,
198
+ loading : "lazy" ,
197
199
variants : image . variants ,
198
200
} ) ;
199
201
} ) ;
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ describe('ImageAsset', () => {
54
54
expect ( image . attributes ( 'width' ) ) . toBe ( '1202' ) ;
55
55
expect ( image . attributes ( 'height' ) ) . toBe ( 'auto' ) ;
56
56
expect ( image . attributes ( 'alt' ) ) . toBe ( alt ) ;
57
+ expect ( image . attributes ( 'decoding' ) ) . toBe ( 'async' ) ;
57
58
} ) ;
58
59
59
60
it ( 'renders an image that has one variant with no appearance trait' , ( ) => {
@@ -85,6 +86,7 @@ describe('ImageAsset', () => {
85
86
expect ( image . attributes ( 'width' ) ) . toBe ( '300' ) ;
86
87
expect ( image . attributes ( 'height' ) ) . toBe ( 'auto' ) ;
87
88
expect ( image . attributes ( 'alt' ) ) . toBe ( '' ) ;
89
+ expect ( image . attributes ( 'decoding' ) ) . toBe ( 'async' ) ;
88
90
} ) ;
89
91
90
92
it ( 'renders an image that has two light variants' , ( ) => {
@@ -128,6 +130,7 @@ describe('ImageAsset', () => {
128
130
expect ( image . attributes ( 'srcset' ) ) . toBe ( `${ url2x } 2x, ${ url3x } 3x` ) ;
129
131
expect ( image . attributes ( 'width' ) ) . toBe ( '1202' ) ;
130
132
expect ( image . attributes ( 'height' ) ) . toBe ( 'auto' ) ;
133
+ expect ( image . attributes ( 'decoding' ) ) . toBe ( 'async' ) ;
131
134
} ) ;
132
135
133
136
it ( 'renders an image that has two dark variants' , ( ) => {
You can’t perform that action at this time.
0 commit comments