Skip to content

Commit

Permalink
Remove the site editor sidebar navigation edit button (#59335)
Browse files Browse the repository at this point in the history
* remove the site editor sidebar navigation edit button

* remove the test for the edit navigation button

* fix test
  • Loading branch information
draganescu authored Feb 24, 2024
1 parent d727cb4 commit 79c60c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 86 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-nav
import ScreenNavigationMoreMenu from './more-menu';
import NavigationMenuEditor from './navigation-menu-editor';
import buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';
import EditButton from './edit-button';

export default function SingleNavigationMenu( {
navigationMenu,
Expand All @@ -30,7 +29,6 @@ export default function SingleNavigationMenu( {
onSave={ handleSave }
onDuplicate={ handleDuplicate }
/>
<EditButton postId={ navigationMenu?.id } />
</>
}
title={ buildNavigationLabel(
Expand Down
67 changes: 5 additions & 62 deletions test/e2e/specs/site-editor/navigation-editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.describe( 'Editing Navigation Menus', () => {
requestUtils,
editor,
} ) => {
await test.step( 'Manually browse to focus mode for a Navigation Menu', async () => {
await test.step( 'Check Navigation block is present and locked', async () => {
// create a Navigation Menu called "Test Menu" using the REST API helpers
const createdMenu = await requestUtils.createNavigationMenu( {
title: 'Primary Menu',
Expand All @@ -34,69 +34,12 @@ test.describe( 'Editing Navigation Menus', () => {
'<!-- wp:navigation-link {"label":"Another Item","type":"custom","url":"http://www.wordpress.org/","kind":"custom"} /-->',
} );

// We could Navigate directly to editing the Navigation Menu but we intentionally do not do this.
//
// Why? To provide coverage for a bug that caused the Navigation Editor behaviours to fail
// only when navigating through the editor screens (rather than going directly to the editor by URL).
// See: https://github.com/WordPress/gutenberg/pull/56856.
//
// Example (what we could do):
// await admin.visitSiteEditor( {
// postId: createdMenu?.id,
// postType: 'wp_navigation',
// } );
//
await admin.visitSiteEditor();

const editorSidebar = page.getByRole( 'region', {
name: 'Navigation',
await admin.visitSiteEditor( {
postId: createdMenu?.id,
postType: 'wp_navigation',
canvas: 'edit',
} );

await editorSidebar
.getByRole( 'button', {
name: 'Navigation',
} )
.click();

// Wait for list of Navigations to appear.
await expect(
editorSidebar.getByRole( 'heading', {
name: 'Navigation',
level: 1,
} )
).toBeVisible();

await expect( page ).toHaveURL(
`wp-admin/site-editor.php?path=%2Fnavigation`
);

await editorSidebar
.getByRole( 'button', {
name: 'Primary Menu',
} )
.click();

await expect( page ).toHaveURL(
`wp-admin/site-editor.php?postId=${ createdMenu?.id }&postType=wp_navigation`
);

// Wait for list of Navigations to appear.
await expect(
editorSidebar.getByRole( 'heading', {
name: 'Primary Menu',
level: 1,
} )
).toBeVisible();

// Switch to editing the Navigation Menu
await editorSidebar
.getByRole( 'link', {
name: 'Edit',
} )
.click();
} );

await test.step( 'Check Navigation block is present and locked', async () => {
// Open List View.
await pageUtils.pressKeys( 'access+o' );

Expand Down

0 comments on commit 79c60c0

Please sign in to comment.