Skip to content

Commit 08996db

Browse files
committed
Add case with Please select option
1 parent 7836bca commit 08996db

File tree

1 file changed

+23
-1
lines changed
  • dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js

1 file changed

+23
-1
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,31 @@ define([
99
], function ($, Configurable) {
1010
'use strict';
1111

12-
var widget;
12+
var widget,
13+
option = '<select name=\'super_attribute[93]\'' +
14+
'data-selector=\'super_attribute[93]\'' +
15+
'data-validate=\'{required:true}\'' +
16+
'id=\'attribute93\'' +
17+
'class=\'super-attribute-select\'>' +
18+
'<option value=\'\'></option>' +
19+
'</select>',
20+
selectElement = $(option);
1321

1422
beforeEach(function () {
1523
widget = new Configurable();
1624
widget.options = {
1725
spConfig: {
26+
chooseText: 'Chose an Option...',
1827
attributes:
1928
{
2029
'size': {
2130
options: $('<div><p class="2"></p></div>')
2231
}
32+
},
33+
prices: {
34+
finalPrice: {
35+
amount: 12
36+
}
2337
}
2438
},
2539
values: {
@@ -34,5 +48,13 @@ define([
3448
widget._parseQueryParams('http://magento.com/product?color=red&size=2');
3549
expect(widget.options.values.size).toBe('2');
3650
});
51+
52+
it('check if attribute value is possible to be set as option with "please select option"', function () {
53+
expect($.mage.configurable).toBeDefined();
54+
widget._fillSelect(selectElement[0]);
55+
expect(selectElement[0].options[0].innerHTML).toBe(widget.options.spConfig.chooseText);
56+
widget._parseQueryParams('http://magento.com/product?color=red&size=2');
57+
expect(widget.options.values.size).toBe('2');
58+
});
3759
});
3860
});

0 commit comments

Comments
 (0)