Skip to content

Commit 8948eee

Browse files
committed
MC-42249: No form validation for negative quantity on bundle products
- Fixed the static test issue
1 parent a90b46c commit 8948eee

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ define([
107107
changes = defaultGetOptionValue(bundleOption, this.options.optionConfig);//eslint-disable-line
108108
}
109109

110+
// eslint-disable-next-line no-use-before-define
110111
if (checkIsValidateQty(bundleOption)) {
111112
if (changes) {
112113
priceBox.trigger('updatePrice', changes);
@@ -134,6 +135,7 @@ define([
134135
.selections[field.data('optionValueId')];
135136
optionConfig.qty = field.val();
136137

138+
// eslint-disable-next-line no-use-before-define
137139
if (checkIsValidateQty(optionInstance)) {
138140
optionInstance.trigger('change');
139141
}
@@ -380,15 +382,16 @@ define([
380382
/**
381383
* Check the quantity field if negative value occurs.
382384
*
383-
* @param bundleOption
385+
* @param {Object} bundleOption
384386
*/
385-
function checkIsValidateQty(bundleOption)
386-
{
387+
function checkIsValidateQty(bundleOption) {
387388
var isValid = 0,
388-
qtyElem = bundleOption.data('qtyField');
389-
if (bundleOption.prop('type') === 'radio' || bundleOption.prop('type') === 'select-one') {
390-
if (qtyElem.val() >= qtyElem.data('validate')['validate-item-quantity'].minAllowed
391-
&& qtyElem.val() <= qtyElem.data('validate')['validate-item-quantity'].maxAllowed
389+
qtyElem = bundleOption.data('qtyField'),
390+
bundleOptionType = bundleOption.prop('type');
391+
392+
if (bundleOptionType === 'radio' || bundleOptionType === 'select-one') {
393+
if (qtyElem.val() >= qtyElem.data('validate')['validate-item-quantity'].minAllowed &&
394+
qtyElem.val() <= qtyElem.data('validate')['validate-item-quantity'].maxAllowed
392395
) {
393396
isValid = 1;
394397
}

0 commit comments

Comments
 (0)