From 8ee751b9e7a1194736d58680416fbd7891809222 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 2 Apr 2024 12:55:13 +0200 Subject: [PATCH 1/7] Improve confirm dialog confirm button text. --- .../src/components/post-switch-to-draft-button/index.js | 4 ++++ packages/editor/src/components/post-trash/index.js | 1 + packages/editor/src/components/post-visibility/index.js | 1 + 3 files changed, 6 insertions(+) diff --git a/packages/editor/src/components/post-switch-to-draft-button/index.js b/packages/editor/src/components/post-switch-to-draft-button/index.js index 133f2c7d2cfd8..bfdfc93ec90af 100644 --- a/packages/editor/src/components/post-switch-to-draft-button/index.js +++ b/packages/editor/src/components/post-switch-to-draft-button/index.js @@ -31,10 +31,13 @@ export default function PostSwitchToDraftButton() { const isDisabled = isSaving || ( ! isPublished && ! isScheduled ); let alertMessage; + let confirmButtonText; if ( isPublished ) { alertMessage = __( 'Are you sure you want to unpublish this post?' ); + confirmButtonText = __( 'Unpublish' ); } else if ( isScheduled ) { alertMessage = __( 'Are you sure you want to unschedule this post?' ); + confirmButtonText = __( 'Unschedule' ); } const handleConfirm = () => { @@ -63,6 +66,7 @@ export default function PostSwitchToDraftButton() { isOpen={ showConfirmDialog } onConfirm={ handleConfirm } onCancel={ () => setShowConfirmDialog( false ) } + confirmButtonText={ confirmButtonText } > { alertMessage } diff --git a/packages/editor/src/components/post-trash/index.js b/packages/editor/src/components/post-trash/index.js index 98fc73702974d..f4f8bfba09af0 100644 --- a/packages/editor/src/components/post-trash/index.js +++ b/packages/editor/src/components/post-trash/index.js @@ -54,6 +54,7 @@ export default function PostTrash() { isOpen={ showConfirmDialog } onConfirm={ handleConfirm } onCancel={ () => setShowConfirmDialog( false ) } + confirmButtonText={ __( 'Move to the trash' ) } > { __( 'Are you sure you want to move this post to the trash?' diff --git a/packages/editor/src/components/post-visibility/index.js b/packages/editor/src/components/post-visibility/index.js index a16682150350e..0dde8905cbb36 100644 --- a/packages/editor/src/components/post-visibility/index.js +++ b/packages/editor/src/components/post-visibility/index.js @@ -125,6 +125,7 @@ export default function PostVisibility( { onClose } ) { isOpen={ showPrivateConfirmDialog } onConfirm={ confirmPrivate } onCancel={ handleDialogCancel } + confirmButtonText={ __( 'Publish' ) } > { __( 'Would you like to privately publish this post now?' ) } From 8031ee89610b08775604615cc8a359c240fb62d0 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 2 Apr 2024 13:12:12 +0200 Subject: [PATCH 2/7] Adjust tests. --- packages/editor/src/components/post-trash/index.js | 2 +- test/e2e/specs/editor/various/change-detection.spec.js | 2 +- test/e2e/specs/editor/various/switch-to-draft.spec.js | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/post-trash/index.js b/packages/editor/src/components/post-trash/index.js index f4f8bfba09af0..ebb078804da6d 100644 --- a/packages/editor/src/components/post-trash/index.js +++ b/packages/editor/src/components/post-trash/index.js @@ -54,7 +54,7 @@ export default function PostTrash() { isOpen={ showConfirmDialog } onConfirm={ handleConfirm } onCancel={ () => setShowConfirmDialog( false ) } - confirmButtonText={ __( 'Move to the trash' ) } + confirmButtonText={ __( 'Move to trash' ) } > { __( 'Are you sure you want to move this post to the trash?' diff --git a/test/e2e/specs/editor/various/change-detection.spec.js b/test/e2e/specs/editor/various/change-detection.spec.js index 9fa20ba3c0c34..8eca8b6536a8a 100644 --- a/test/e2e/specs/editor/various/change-detection.spec.js +++ b/test/e2e/specs/editor/various/change-detection.spec.js @@ -417,7 +417,7 @@ test.describe( 'Change detection', () => { .click(); await page .getByRole( 'dialog' ) - .getByRole( 'button', { name: 'OK' } ) + .getByRole( 'button', { name: 'Move to trash' } ) .click(); await expect( diff --git a/test/e2e/specs/editor/various/switch-to-draft.spec.js b/test/e2e/specs/editor/various/switch-to-draft.spec.js index 5cfeda60a2d18..536f1cbb95c01 100644 --- a/test/e2e/specs/editor/various/switch-to-draft.spec.js +++ b/test/e2e/specs/editor/various/switch-to-draft.spec.js @@ -65,9 +65,12 @@ test.describe( 'Clicking "Switch to draft" on a published/scheduled post/page', await switchToDraftUtils.switchToDraftButton.click(); + const confirmButtonText = + postStatus === 'publish' ? 'Unpublish' : 'Unschedule'; + await page .getByRole( 'dialog' ) - .getByRole( 'button', { name: 'OK' } ) + .getByRole( 'button', { name: confirmButtonText } ) .click(); await expect( From 894851c4202b2d8710557b69334e0e6a193ed2bc Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 2 Apr 2024 14:54:10 +0200 Subject: [PATCH 3/7] Adjust more tests. --- test/e2e/specs/editor/various/post-visibility.spec.js | 4 ++-- test/e2e/specs/editor/various/preview.spec.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/specs/editor/various/post-visibility.spec.js b/test/e2e/specs/editor/various/post-visibility.spec.js index 0c367fb94ef6e..898189085dc28 100644 --- a/test/e2e/specs/editor/various/post-visibility.spec.js +++ b/test/e2e/specs/editor/various/post-visibility.spec.js @@ -23,7 +23,7 @@ test.describe( 'Post visibility', () => { await page.click( 'role=radio[name="Private"i]' ); - await page.click( 'role=button[name="OK"i]' ); + await page.click( 'role=button[name="Publish"i]' ); const currentStatus = await page.evaluate( () => { return window.wp.data @@ -99,7 +99,7 @@ test.describe( 'Post visibility', () => { await page.click( 'role=radio[name="Private"i]' ); - await page.click( 'role=button[name="OK"i]' ); + await page.click( 'role=button[name="Publish"i]' ); const currentStatus = await page.evaluate( () => { return window.wp.data diff --git a/test/e2e/specs/editor/various/preview.spec.js b/test/e2e/specs/editor/various/preview.spec.js index 0657a45567baf..bf2652b832574 100644 --- a/test/e2e/specs/editor/various/preview.spec.js +++ b/test/e2e/specs/editor/various/preview.spec.js @@ -188,7 +188,7 @@ test.describe( 'Preview', () => { .getByRole( 'button', { name: 'Switch to draft' } ) .click(); // FIXME: The confirmation dialog is not named yet. - await page.click( 'role=dialog >> role=button[name="OK"i]' ); + await page.click( 'role=dialog >> role=button[name="Unpublish"i]' ); // Wait for the status change. // @see https://github.com/WordPress/gutenberg/pull/43933 From 91ab2aa76f64994681a727e1184a249884c63eaa Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 3 Apr 2024 12:42:31 +0200 Subject: [PATCH 4/7] Improve apply revision confirm dialog copy. --- .../src/components/global-styles/screen-revisions/index.js | 2 +- test/e2e/specs/site-editor/user-global-styles-revisions.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/screen-revisions/index.js b/packages/edit-site/src/components/global-styles/screen-revisions/index.js index 84c7dae8976b0..6a20e23c91674 100644 --- a/packages/edit-site/src/components/global-styles/screen-revisions/index.js +++ b/packages/edit-site/src/components/global-styles/screen-revisions/index.js @@ -215,7 +215,7 @@ function ScreenRevisions() { } > { __( - 'Any unsaved changes will be lost when you apply this revision.' + 'Are you sure you want to apply this revision? Any unsaved changes will be lost.' ) } ) } diff --git a/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js b/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js index 666e80eb5eb8b..7dde5451a494c 100644 --- a/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js +++ b/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js @@ -101,7 +101,7 @@ test.describe( 'Style Revisions', () => { const confirm = page.getByRole( 'dialog' ); await expect( confirm ).toBeVisible(); await expect( confirm ).toHaveText( - /^Any unsaved changes will be lost when you apply this revision./ + /^Are you sure you want to apply this revision? Any unsaved changes will be lost./ ); // This is to make sure there are no lingering unsaved changes. From 934b49f8f828cb95cff7e13967bf9c9e34c320c8 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 3 Apr 2024 12:45:03 +0200 Subject: [PATCH 5/7] Improve edit template confirm dialog copy. --- .../editor-canvas/edit-template-blocks-notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js b/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js index 48542e58a8732..bc7f20d02987e 100644 --- a/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js +++ b/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js @@ -68,7 +68,7 @@ export default function EditTemplateBlocksNotification( { contentRef } ) { onCancel={ () => setIsDialogOpen( false ) } > { __( - 'You’ve tried to select a block that is part of a template, which may be used on other posts and pages.' + 'Would you like to edit the template this block is part of?' ) } ); From 617f4045ae747fbc87459ff4d77b47adc93dcff7 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 10 Apr 2024 16:57:07 +0200 Subject: [PATCH 6/7] Update string. --- .../editor-canvas/edit-template-blocks-notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js b/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js index bc7f20d02987e..9bb4ab667e45b 100644 --- a/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js +++ b/packages/editor/src/components/editor-canvas/edit-template-blocks-notification.js @@ -68,7 +68,7 @@ export default function EditTemplateBlocksNotification( { contentRef } ) { onCancel={ () => setIsDialogOpen( false ) } > { __( - 'Would you like to edit the template this block is part of?' + 'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?.' ) } ); From 7a284fcbada1449c7f7fdcb8b107430abb0c9662 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Thu, 11 Apr 2024 09:11:21 +0200 Subject: [PATCH 7/7] Adjust test. --- test/e2e/specs/site-editor/user-global-styles-revisions.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js b/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js index 7dde5451a494c..9eb98e55005c7 100644 --- a/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js +++ b/test/e2e/specs/site-editor/user-global-styles-revisions.spec.js @@ -101,7 +101,7 @@ test.describe( 'Style Revisions', () => { const confirm = page.getByRole( 'dialog' ); await expect( confirm ).toBeVisible(); await expect( confirm ).toHaveText( - /^Are you sure you want to apply this revision? Any unsaved changes will be lost./ + /^Are you sure you want to apply this revision\? Any unsaved changes will be lost./ ); // This is to make sure there are no lingering unsaved changes.