Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Prevent coupon error being removed when blurring the input and fix tests #8349

Merged
merged 5 commits into from
Feb 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ const ValidatedTextInput = ( {
inputObject.value = inputObject.value.trim();
inputObject.setCustomValidity( '' );

if ( previousValue === inputObject.value ) {
return;
}

const inputIsValid = customValidation
? inputObject.checkValidity() && customValidation( inputObject )
: inputObject.checkValidity();
Expand All @@ -120,6 +124,7 @@ const ValidatedTextInput = ( {
} );
},
[
previousValue,
clearValidationError,
customValidation,
errorIdString,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/shopper/cart-checkout/checkout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ describe( 'Shopper → Checkout', () => {
await shopper.block.goToCheckout();
await shopper.block.applyCouponFromCheckout( coupon.code );
await page.waitForSelector(
'.wc-block-components-notices__notice'
'.wc-block-components-totals-coupon__content .wc-block-components-validation-error'
);
await expect( page ).toMatch(
'Coupon usage limit has been reached.'
Expand Down