Skip to content

Commit

Permalink
ENGCOM-6520: Fixed Special Price class not added in configurable prod…
Browse files Browse the repository at this point in the history
…uct page #26170
  • Loading branch information
VladimirZaets authored Dec 29, 2019
2 parents 6bfdbd3 + 4750240 commit b596ffb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,8 @@ define([

isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;

$productPrice.find('span:first').toggleClass('special-price', isShow);

$product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();

if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define([
id: optionId
}]
};

widget.options = {
classes: {
optionClass: 'swatch-option'
Expand All @@ -50,6 +51,7 @@ define([
}
}
};

optionConfig = widget.options.jsonSwatchConfig[attribute.id];
html = $(widget._RenderSwatchOptions(attribute, 'option-label-control-id-1'))[0];
});
Expand All @@ -76,5 +78,25 @@ define([
expect(html.style.height).toEqual(swathImageHeight + 'px');
expect(html.style.width).toEqual(swathImageWidth + 'px');
});

it('check udate price method', function () {
var productPriceMock = {
find: jasmine.createSpy().and.returnValue({
hide: jasmine.createSpy(),
priceBox: jasmine.createSpy().and.returnValue(''),
trigger: jasmine.createSpy(),
find: jasmine.createSpy().and.returnValue({
toggleClass: jasmine.createSpy()
})
})
};

widget.element = {
parents: jasmine.createSpy().and.returnValue(productPriceMock)
};
widget._getNewPrices = jasmine.createSpy().and.returnValue(undefined);
widget._UpdatePrice();
expect(productPriceMock.find().find.calls.count()).toBe(1);
});
});
});

0 comments on commit b596ffb

Please sign in to comment.