Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed update product qty by typing the new qty in the cart page #1469

Merged
1 commit merged into from Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Draft
- Explicitly disable autocomplete in password entry input fields. [#1465](https://github.com/bigcommerce/cornerstone/pull/1465)
- Fixed update product qty by typing the new qty in the cart page (not with the arrows). [#1469](https://github.com/bigcommerce/cornerstone/pull/1469)

## 3.3.0 (2019-03-18)
- Add option to hide breadcrumbs and page title. [#1444](https://github.com/bigcommerce/cornerstone/pull/1444)
Expand Down
3 changes: 1 addition & 2 deletions assets/js/test-unit/theme/cart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ describe('cartUpdateQtyTextChange', () => {
it('should CHANGE qty completly based on the cart-item-qty-input', () => {
dataSpy
dataSpy('manualQtyChange');
spyOn(jQuery.fn, 'attr').and.returnValue(5);
spyOn(jQuery.fn, 'val').and.returnValue(2);
spyOn(jQuery.fn, 'val').and.returnValue(5, 2);
c.cartUpdateQtyTextChange($dom);

expect(UpdateSpy).toHaveBeenCalledWith('11111', 5, jasmine.any(Function));
Expand Down
5 changes: 3 additions & 2 deletions assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ export default class Cart extends PageManager {
const oldQty = preVal !== null ? preVal : minQty;
const minError = $el.data('quantityMinError');
const maxError = $el.data('quantityMaxError');
const newQty = parseInt(Number($el.attr('value')), 10);
const newQty = parseInt(Number($el.val()), 10);
let invalidEntry;

// Does not quality for min/max quantity
if (!newQty) {
invalidEntry = $el.attr('value');
invalidEntry = $el.val();
$el.val(oldQty);
return swal({
text: `${invalidEntry} is not a valid entry`,
Expand Down