-
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.
Merge branch 'develop' into add/transaction-id-to-refund-endpoint
- Loading branch information
Showing
17 changed files
with
1,094 additions
and
1,314 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,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Display a Confirmaton Modal on enabling Test Mode |
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,4 @@ | ||
Significance: minor | ||
Type: dev | ||
|
||
Cleanup the deprecated payment gateway processing - part IV |
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: fix | ||
Comment: Modified the test phone numbers supported by Stripe. | ||
|
||
|
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
63 changes: 63 additions & 0 deletions
63
client/settings/general-settings/test-mode-confirm-modal.tsx
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,63 @@ | ||
/** @format **/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import { Button, ExternalLink } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ConfirmationModal from '../../components/confirmation-modal'; | ||
|
||
interface TestModeConfirmationModalProps { | ||
onClose: () => void; | ||
onConfirm: () => void; | ||
} | ||
|
||
const TestModeConfirmationModal: React.FC< TestModeConfirmationModalProps > = ( { | ||
onClose, | ||
onConfirm, | ||
} ) => { | ||
return ( | ||
<ConfirmationModal | ||
title={ __( 'Enable test mode', 'woocommerce-payments' ) } | ||
onRequestClose={ onClose } | ||
actions={ | ||
<> | ||
<Button onClick={ onClose } variant="secondary"> | ||
{ __( 'Cancel', 'woocommerce-payments' ) } | ||
</Button> | ||
<Button onClick={ onConfirm } variant="primary"> | ||
{ __( 'Enable', 'woocommerce-payments' ) } | ||
</Button> | ||
</> | ||
} | ||
> | ||
<h3> | ||
{ __( | ||
'Are you sure you want to enable test mode?', | ||
'woocommerce-payments' | ||
) } | ||
</h3> | ||
<p> | ||
{ __( | ||
"Test mode lets you try out payments, refunds, disputes and other such processes as you're working on your store " + | ||
'without handling live payment information. ' + | ||
'All incoming orders will be simulated, and test mode will have to be disabled before you can accept real orders.', | ||
'woocommerce-payments' | ||
) } | ||
</p> | ||
<ExternalLink | ||
// eslint-disable-next-line max-len | ||
href="https://woo.com/document/woopayments/testing-and-troubleshooting/testing/" | ||
> | ||
{ __( 'Learn more about test mode', 'woocommerce-payments' ) } | ||
</ExternalLink> | ||
</ConfirmationModal> | ||
); | ||
}; | ||
|
||
export default TestModeConfirmationModal; |
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
50 changes: 50 additions & 0 deletions
50
client/settings/general-settings/test/test-mode-confirm-modal.test.js
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,50 @@ | ||
/** @format */ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import user from '@testing-library/user-event'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import TestModeConfirmationModal from '../test-mode-confirm-modal'; | ||
|
||
const mockOnClose = jest.fn(); | ||
const mockOnConfirm = jest.fn(); | ||
|
||
describe( 'Dev Mode Confirmation Modal', () => { | ||
const renderTestModeConfirmationModal = () => { | ||
return render( | ||
<TestModeConfirmationModal | ||
onClose={ mockOnClose } | ||
onConfirm={ mockOnConfirm } | ||
/> | ||
); | ||
}; | ||
|
||
it( 'Dev mode confirmation modal asks confirmation', () => { | ||
renderTestModeConfirmationModal(); | ||
expect( | ||
screen.queryByText( 'Are you sure you want to enable test mode?' ) | ||
).toBeInTheDocument(); | ||
} ); | ||
|
||
it( 'triggers the onClose function on close button click', () => { | ||
renderTestModeConfirmationModal(); | ||
const closeButton = screen.queryByRole( 'button', { name: 'Cancel' } ); | ||
expect( mockOnClose ).not.toBeCalled(); | ||
user.click( closeButton ); | ||
expect( mockOnClose ).toBeCalled(); | ||
} ); | ||
|
||
it( 'triggers the onConfirm function on Enable button click', () => { | ||
renderTestModeConfirmationModal(); | ||
const enableButton = screen.queryByRole( 'button', { name: 'Enable' } ); | ||
expect( mockOnConfirm ).not.toBeCalled(); | ||
user.click( enableButton ); | ||
expect( mockOnConfirm ).toBeCalled(); | ||
} ); | ||
} ); |
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.