Skip to content
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
7 changes: 5 additions & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
legacy-peer-deps=true
engine-strict=true
save-exact = true
engine-strict = true
legacy-peer-deps = true
prefer-dedupe = true
lockfile-version = 3
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.18.0
v20.18.1
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*** Changelog ***

= 9.10.0 - xxxx-xx-xx =
* Dev - Upgrades Node to v20
* Add - Allow the purchase of free trials using the Express Payment methods when the product does not require shipping
* Update - Changes the documentation page URL for the Optimized Checkout feature to https://woocommerce.com/document/stripe/admin-experience/optimized-checkout-suite/
* Update - Changes the background color and spacing for the Woo logo shown in the account modal
Expand Down
25 changes: 10 additions & 15 deletions client/stripe-utils/__tests__/cash-app-limit-notice-handler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,54 @@ const wrapperElementClassName = 'woocommerce-checkout-payment';

jest.mock( 'wcstripe/blocks/upe/call-when-element-is-available' );

const elementLoadingDelay = 500;

callWhenElementIsAvailable.mockImplementation(
( selector, callable, params ) => {
setTimeout( () => {
callable( ...params );
}, elementLoadingDelay );
callable( ...params );
}
);

jest.useFakeTimers();

describe( 'cash-app-limit-notice-handler', () => {
it( 'does not render notice, cart amount is below threshold, wrapper not found and it is not a block checkout', () => {
maybeShowCashAppLimitNotice(
'.woocommerce-checkout-payment',
0,
false
);

expect(
screen.queryByTestId( 'cash-app-limit-notice' )
).not.toBeInTheDocument();
} );

it( 'does not render notice, cart amount is below threshold, but try to wait for wrapper to exist (block checkout)', () => {
render( <div data-block-name="woocommerce/checkout" /> );

maybeShowCashAppLimitNotice( '.woocommerce-checkout-payment', 0, true );

expect(
screen.queryByTestId( 'cash-app-limit-notice' )
).not.toBeInTheDocument();
} );

it( 'render notice immediately (not block checkout, cart amount above threshold)', () => {
render( <div className={ wrapperElementClassName } /> );

maybeShowCashAppLimitNotice(
'.woocommerce-checkout-payment',
CASH_APP_NOTICE_AMOUNT_THRESHOLD + 1,
false
);

expect(
screen.queryByTestId( 'cash-app-limit-notice' )
).toBeInTheDocument();
} );

it( 'render notice after wrapper exists on block checkout (cart amount above threshold)', () => {
it( 'render notice after wrapper exists on block checkout (cart amount above threshold)', async () => {
function App() {
setTimeout( () => {
const wrapper = document.createElement( 'div' );
wrapper.classList.add( wrapperElementClassName );
document.body.appendChild( wrapper );
}, elementLoadingDelay - 100 );
const wrapper = document.createElement( 'div' );
wrapper.classList.add( wrapperElementClassName );
document.body.appendChild( wrapper );
return <div data-block-name="woocommerce/checkout" />;
}

Expand All @@ -69,8 +66,6 @@ describe( 'cash-app-limit-notice-handler', () => {
true
);

jest.runAllTimers();

expect(
screen.queryByTestId( 'cash-app-limit-notice' )
).toBeInTheDocument();
Expand Down
Loading
Loading