Skip to content

Commit e8b7b00

Browse files
committed
JS-323: Gallery setting for configurable product
- Static test improvment
1 parent 060ed3d commit e8b7b00

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,8 @@ define([
912912
var justAnImage = images[0],
913913
updateImg,
914914
imagesToUpdate,
915-
gallery = context.find(this.options.mediaGallerySelector).data('gallery');
915+
gallery = context.find(this.options.mediaGallerySelector).data('gallery'),
916+
item;
916917

917918
if (images) {
918919
imagesToUpdate = this._setImageType($.extend(true, [], images));
@@ -924,11 +925,8 @@ define([
924925
return img.isMain;
925926
});
926927

927-
if (updateImg.length) {
928-
gallery.updateDataByIndex(0, updateImg[0]);
929-
} else {
930-
gallery.updateDataByIndex(0, imagesToUpdate[0]);
931-
}
928+
item = updateImg.length ? updateImg[0]: imagesToUpdate[0];
929+
gallery.updateDataByIndex(0, item);
932930

933931
gallery.seek(1);
934932
} else {

0 commit comments

Comments
 (0)