-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable activation of LPM's requiring additional currencies when MC i…
…s disabled (#7211) Co-authored-by: Jesse Pearson <[email protected]>
- Loading branch information
1 parent
20aaa54
commit b011b37
Showing
8 changed files
with
273 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: add | ||
Comment: Added notice when a LPM is selected that requires additional currencies when MC is disabled | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,13 @@ | |
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import { act, render, screen, waitFor } from '@testing-library/react'; | ||
import { | ||
act, | ||
fireEvent, | ||
render, | ||
screen, | ||
waitFor, | ||
} from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
/** | ||
|
@@ -120,6 +126,8 @@ describe( 'AddPaymentMethodsTask', () => { | |
useManualCapture.mockReturnValue( [ false, jest.fn() ] ); | ||
useAccountDomesticCurrency.mockReturnValue( 'usd' ); | ||
global.wcpaySettings = { | ||
isMultiCurrencyEnabled: true, | ||
storeCurrency: 'USD', | ||
accountEmail: '[email protected]', | ||
}; | ||
} ); | ||
|
@@ -443,4 +451,54 @@ describe( 'AddPaymentMethodsTask', () => { | |
|
||
jest.useRealTimers(); | ||
} ); | ||
|
||
it( "should render the setup tooltip correctly when multi currency is disabled and store currency doesn't support the LPM", () => { | ||
global.wcpaySettings.isMultiCurrencyEnabled = false; | ||
global.wcpaySettings.storeCurrency = 'USD'; | ||
const setCompletedMock = jest.fn(); | ||
useEnabledPaymentMethodIds.mockReturnValue( [ [ 'card' ], jest.fn() ] ); | ||
useGetAvailablePaymentMethodIds.mockReturnValue( [ 'bancontact' ] ); | ||
useGetPaymentMethodStatuses.mockReturnValue( { | ||
bancontact_payments: { | ||
status: upeCapabilityStatuses.ACTIVE, | ||
requirements: [], | ||
}, | ||
} ); | ||
|
||
const { container } = render( | ||
<SettingsContextProvider> | ||
<WizardTaskContext.Provider | ||
value={ { setCompleted: setCompletedMock, isActive: true } } | ||
> | ||
<AddPaymentMethodsTask /> | ||
</WizardTaskContext.Provider> | ||
</SettingsContextProvider> | ||
); | ||
|
||
expect( | ||
screen.queryByLabelText( 'Bancontact' ) | ||
).not.toBeInTheDocument(); | ||
|
||
const svgIcon = container.querySelectorAll( | ||
'.gridicons-notice-outline' | ||
)[ 0 ]; | ||
|
||
expect( svgIcon ).toBeInTheDocument(); | ||
|
||
jest.useFakeTimers(); | ||
|
||
act( () => { | ||
fireEvent.mouseOver( svgIcon, { | ||
view: window, | ||
bubbles: true, | ||
cancelable: true, | ||
} ); | ||
jest.runAllTimers(); | ||
} ); | ||
|
||
expect( | ||
screen.queryByText( /Bancontact requires the EUR currency\./ ) | ||
).toBeInTheDocument(); | ||
jest.useRealTimers(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.