From 2cb9388c84e9ae0a8c468c412294c954fa5c8b56 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 10 Jul 2024 14:17:36 +0200 Subject: [PATCH 1/2] Fix Change status label. --- packages/editor/src/components/post-status/index.js | 2 +- test/e2e/specs/editor/various/change-detection.spec.js | 4 +--- test/e2e/specs/editor/various/post-visibility.spec.js | 6 ++---- test/e2e/specs/editor/various/preview.spec.js | 4 +--- test/e2e/specs/editor/various/switch-to-draft.spec.js | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/editor/src/components/post-status/index.js b/packages/editor/src/components/post-status/index.js index ca89e40366b23..04e2a3e2b090a 100644 --- a/packages/editor/src/components/post-status/index.js +++ b/packages/editor/src/components/post-status/index.js @@ -179,7 +179,7 @@ export default function PostStatus() { icon={ postStatusesInfo[ status ]?.icon } aria-label={ sprintf( // translators: %s: Current post status. - __( 'Change post status: %s' ), + __( 'Change status: %s' ), postStatusesInfo[ status ]?.label ) } > diff --git a/test/e2e/specs/editor/various/change-detection.spec.js b/test/e2e/specs/editor/various/change-detection.spec.js index 30b2287a8d943..12d13b4890e36 100644 --- a/test/e2e/specs/editor/various/change-detection.spec.js +++ b/test/e2e/specs/editor/various/change-detection.spec.js @@ -80,9 +80,7 @@ test.describe( 'Change detection', () => { // Toggle post as needing review (not persisted for autosave). await editor.openDocumentSettingsSidebar(); - await page - .getByRole( 'button', { name: 'Change post status:' } ) - .click(); + await page.getByRole( 'button', { name: 'Change status:' } ).click(); await page.getByRole( 'radio', { name: 'Pending' } ).click(); // Force autosave to occur immediately. await Promise.all( [ diff --git a/test/e2e/specs/editor/various/post-visibility.spec.js b/test/e2e/specs/editor/various/post-visibility.spec.js index 61cd5e65f0101..67c8597953815 100644 --- a/test/e2e/specs/editor/various/post-visibility.spec.js +++ b/test/e2e/specs/editor/various/post-visibility.spec.js @@ -18,7 +18,7 @@ test.describe( 'Post visibility', () => { await editor.openDocumentSettingsSidebar(); await page - .getByRole( 'button', { name: 'Change post status:' } ) + .getByRole( 'button', { name: 'Change status:' } ) .click(); await page.getByRole( 'radio', { name: 'Private' } ).click(); @@ -57,9 +57,7 @@ test.describe( 'Post visibility', () => { name: 'Close', } ) .click(); - await page - .getByRole( 'button', { name: 'Change post status:' } ) - .click(); + await page.getByRole( 'button', { name: 'Change status:' } ).click(); await page.getByRole( 'radio', { name: 'Private' } ).click(); await page .getByRole( 'region', { name: 'Editor top bar' } ) diff --git a/test/e2e/specs/editor/various/preview.spec.js b/test/e2e/specs/editor/various/preview.spec.js index b25d1da48122c..e15f143983b74 100644 --- a/test/e2e/specs/editor/various/preview.spec.js +++ b/test/e2e/specs/editor/various/preview.spec.js @@ -183,9 +183,7 @@ test.describe( 'Preview', () => { // Return to editor and switch to Draft. await editorPage.bringToFront(); - await page - .getByRole( 'button', { name: 'Change post status:' } ) - .click(); + await page.getByRole( 'button', { name: 'Change status:' } ).click(); await page.getByRole( 'radio', { name: 'Draft' } ).click(); await page .getByRole( 'region', { name: 'Editor top bar' } ) 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 516de6d0c85cc..81652d9c11e2b 100644 --- a/test/e2e/specs/editor/various/switch-to-draft.spec.js +++ b/test/e2e/specs/editor/various/switch-to-draft.spec.js @@ -47,7 +47,7 @@ test.describe( 'Clicking "Switch to draft" on a published/scheduled post/page', await editor.openDocumentSettingsSidebar(); await page - .getByRole( 'button', { name: 'Change post status:' } ) + .getByRole( 'button', { name: 'Change status:' } ) .click(); await page.getByRole( 'radio', { name: 'Draft' } ).click(); From 67648724c9a7bc6b5693a8d337bdca78f9317484 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 10 Jul 2024 16:01:51 +0200 Subject: [PATCH 2/2] Add missing aria-expanded attribute to Status setting. --- packages/editor/src/components/post-status/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-status/index.js b/packages/editor/src/components/post-status/index.js index 04e2a3e2b090a..1d3050e7e3dd6 100644 --- a/packages/editor/src/components/post-status/index.js +++ b/packages/editor/src/components/post-status/index.js @@ -171,7 +171,7 @@ export default function PostStatus() { contentClassName="editor-change-status__content" popoverProps={ popoverProps } focusOnMount - renderToggle={ ( { onToggle } ) => ( + renderToggle={ ( { onToggle, isOpen } ) => (