File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -98,5 +98,37 @@ define([
98
98
widget . _UpdatePrice ( ) ;
99
99
expect ( productPriceMock . find ( ) . find . calls . count ( ) ) . toBe ( 1 ) ;
100
100
} ) ;
101
+
102
+ it ( 'check getSelectedOptionPriceIndex' , function ( ) {
103
+ var optionMock = '<div class="swatch-attribute" attribute-id="2" option-selected="4"></div>' ,
104
+ element = $ ( '<div class="' + widget . options . tooltipClass +
105
+ '"><div class="image"></div><div class="title"></div><div class="corner"></div>' +
106
+ optionMock + '</div>'
107
+ ) ,
108
+ optionPricesMock = {
109
+ optionPrices : {
110
+ p : {
111
+ finalPrice : {
112
+ amount : 12
113
+ }
114
+ }
115
+ }
116
+ } ;
117
+
118
+ widget . element = element ;
119
+ widget . options . classes . attributeClass = 'swatch-attribute' ;
120
+ widget . options . jsonConfig = optionPricesMock ;
121
+ widget . optionsMap = {
122
+ 2 : {
123
+ 4 : {
124
+ products : 'p'
125
+ } ,
126
+ hasOwnProperty : jasmine . createSpy ( ) . and . returnValue ( true )
127
+ } ,
128
+ hasOwnProperty : jasmine . createSpy ( ) . and . returnValue ( true )
129
+ } ;
130
+
131
+ expect ( widget . _getSelectedOptionPriceIndex ( ) ) . toBe ( 'p' ) ;
132
+ } ) ;
101
133
} ) ;
102
134
} ) ;
You can’t perform that action at this time.
0 commit comments