Skip to content

Commit e037d51

Browse files
committed
Fix static test, civer with jasmine test
1 parent 666d4c0 commit e037d51

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ define([
952952

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

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

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

dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ define([
2828
id: optionId
2929
}]
3030
};
31+
3132
widget.options = {
3233
classes: {
3334
optionClass: 'swatch-option'
@@ -50,6 +51,7 @@ define([
5051
}
5152
}
5253
};
54+
5355
optionConfig = widget.options.jsonSwatchConfig[attribute.id];
5456
html = $(widget._RenderSwatchOptions(attribute, 'option-label-control-id-1'))[0];
5557
});
@@ -76,5 +78,25 @@ define([
7678
expect(html.style.height).toEqual(swathImageHeight + 'px');
7779
expect(html.style.width).toEqual(swathImageWidth + 'px');
7880
});
81+
82+
it('check udate price method', function () {
83+
var productPriceMock = {
84+
find: jasmine.createSpy().and.returnValue({
85+
hide: jasmine.createSpy(),
86+
priceBox: jasmine.createSpy().and.returnValue(''),
87+
trigger: jasmine.createSpy(),
88+
find: jasmine.createSpy().and.returnValue({
89+
toggleClass: jasmine.createSpy()
90+
})
91+
})
92+
};
93+
94+
widget.element = {
95+
parents: jasmine.createSpy().and.returnValue(productPriceMock)
96+
};
97+
widget._getNewPrices = jasmine.createSpy().and.returnValue(undefined);
98+
widget._UpdatePrice();
99+
expect(productPriceMock.find().find.calls.count()).toBe(1);
100+
});
79101
});
80102
});

0 commit comments

Comments
 (0)