File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
app/code/Magento/Swatches/view/base/web/js
dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -952,6 +952,8 @@ define([
952
952
953
953
isShow = typeof result != 'undefined' && result . oldPrice . amount !== result . finalPrice . amount ;
954
954
955
+ $productPrice . find ( 'span:first' ) . toggleClass ( 'special-price' , isShow ) ;
956
+
955
957
$product . find ( this . options . slyOldPriceSelector ) [ isShow ? 'show' : 'hide' ] ( ) ;
956
958
957
959
if ( typeof result != 'undefined' && result . tierPrices && result . tierPrices . length ) {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ define([
28
28
id : optionId
29
29
} ]
30
30
} ;
31
+
31
32
widget . options = {
32
33
classes : {
33
34
optionClass : 'swatch-option'
@@ -50,6 +51,7 @@ define([
50
51
}
51
52
}
52
53
} ;
54
+
53
55
optionConfig = widget . options . jsonSwatchConfig [ attribute . id ] ;
54
56
html = $ ( widget . _RenderSwatchOptions ( attribute , 'option-label-control-id-1' ) ) [ 0 ] ;
55
57
} ) ;
@@ -76,5 +78,25 @@ define([
76
78
expect ( html . style . height ) . toEqual ( swathImageHeight + 'px' ) ;
77
79
expect ( html . style . width ) . toEqual ( swathImageWidth + 'px' ) ;
78
80
} ) ;
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
+ } ) ;
79
101
} ) ;
80
102
} ) ;
You can’t perform that action at this time.
0 commit comments