From 436a87df4f1a8c1e49a8aea434bef5fe4177566e Mon Sep 17 00:00:00 2001 From: John Watkins Date: Mon, 6 Jul 2020 10:03:53 -0500 Subject: [PATCH] Onboarding wizard close link: return to previous location --- assets/src/setup/__mocks__/amp-setup.js | 3 +- .../setup/components/error-screen/index.js | 8 ++-- .../components/error-screen/test/index.js | 2 +- assets/src/setup/components/nav/index.js | 12 +++--- assets/src/setup/components/nav/test/index.js | 8 ++-- assets/src/setup/index.js | 7 ++-- assets/src/setup/setup-wizard.js | 11 +++-- .../class-amp-setup-wizard-submenu-page.php | 7 +++- tests/e2e/specs/amp-onboarding/exit-links.js | 40 +++++++++++++++++++ tests/e2e/utils/onboarding-wizard-utils.js | 11 ++++- 10 files changed, 83 insertions(+), 26 deletions(-) create mode 100644 tests/e2e/specs/amp-onboarding/exit-links.js diff --git a/assets/src/setup/__mocks__/amp-setup.js b/assets/src/setup/__mocks__/amp-setup.js index d44eb979975..2c45a91f103 100644 --- a/assets/src/setup/__mocks__/amp-setup.js +++ b/assets/src/setup/__mocks__/amp-setup.js @@ -1,9 +1,10 @@ module.exports = { APP_ROOT_ID: 'amp-setup', + CLOSE_LINK: 'http://site.test/wp-admin/?page=amp-options', CURRENT_THEME: { name: 'Twenty Twenty', }, - EXIT_LINK: 'http://site.test/wp-admin/?page=amp-options', + FINISH_LINK: 'http://site.test/wp-admin/?page=amp-options', OPTIONS_REST_ENDPOINT: 'http://site.test/wp-json/amp/v1/options', READER_THEMES_REST_ENDPOINT: 'http://site.test/wp-json/amp/v1/reader-themes', UPDATES_NONCE: '', diff --git a/assets/src/setup/components/error-screen/index.js b/assets/src/setup/components/error-screen/index.js index 1f715849468..ffceb093d13 100644 --- a/assets/src/setup/components/error-screen/index.js +++ b/assets/src/setup/components/error-screen/index.js @@ -19,9 +19,9 @@ import './style.css'; * * @param {Object} props Component props. * @param {Object} props.error Error object containing a message string. - * @param {string} props.exitLink The link to return to the admin. + * @param {string} props.finishLink The link to return to the admin. */ -export function ErrorScreen( { error, exitLink } ) { +export function ErrorScreen( { error, finishLink } ) { return (
@@ -34,7 +34,7 @@ export function ErrorScreen( { error, exitLink } ) { dangerouslySetInnerHTML={ { __html: error.message || __( 'There was an error loading the setup wizard.', 'amp' ) } } /> { ' ' } - + { __( 'Return to AMP settings.', 'amp' ) }

@@ -47,5 +47,5 @@ ErrorScreen.propTypes = { error: PropTypes.shape( { message: PropTypes.string, } ).isRequired, - exitLink: PropTypes.string.isRequired, + finishLink: PropTypes.string.isRequired, }; diff --git a/assets/src/setup/components/error-screen/test/index.js b/assets/src/setup/components/error-screen/test/index.js index 96e4fafa23c..53ba9aa7299 100644 --- a/assets/src/setup/components/error-screen/test/index.js +++ b/assets/src/setup/components/error-screen/test/index.js @@ -12,7 +12,7 @@ import { ErrorScreen } from '..'; describe( 'ErrorScreen', () => { it( 'matches snapshot', () => { const wrapper = create( - , + , ); expect( wrapper.toJSON() ).toMatchSnapshot(); } ); diff --git a/assets/src/setup/components/nav/index.js b/assets/src/setup/components/nav/index.js index 929c7c96949..f951dedfb8f 100644 --- a/assets/src/setup/components/nav/index.js +++ b/assets/src/setup/components/nav/index.js @@ -22,9 +22,10 @@ import { User } from '../user-context-provider'; * Navigation component. * * @param {Object} props Component props. - * @param {string} props.exitLink Link to exit the application. + * @param {string} props.closeLink Link to return to previous user location. + * @param {string} props.finishLink Link to exit the application. */ -export function Nav( { exitLink } ) { +export function Nav( { closeLink, finishLink } ) { const { activePageIndex, canGoForward, isLastPage, moveBack, moveForward } = useContext( Navigation ); const { savingOptions } = useContext( Options ); const { savingDeveloperToolsOption } = useContext( User ); @@ -34,7 +35,7 @@ export function Nav( { exitLink } ) {
{ ! isLastPage && ( -