Skip to content

Commit

Permalink
renaming variables and custom link label
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Feb 13, 2023
1 parent 0dab307 commit 4d4d736
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions packages/e2e-test-utils-playwright/src/request-utils/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface MenuData {
title: string;
content: string;
}
export interface Menu {
export interface NavigationMenu {
id: number;
content: string;
status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
Expand All @@ -22,14 +22,14 @@ export interface Menu {
export async function createClassicMenu( this: RequestUtils, name: string ) {
const menuItems = [
{
title: 'Home',
title: 'Custom link',
url: 'http://localhost:8889/',
type: 'custom',
menu_order: 1,
},
];

const menu = await this.rest< Menu >( {
const menu = await this.rest< NavigationMenu >( {
method: 'POST',
path: `/wp/v2/menus/`,
data: {
Expand Down Expand Up @@ -80,7 +80,7 @@ export async function createNavigationMenu(
*
*/
export async function deleteAllMenus( this: RequestUtils ) {
const navMenus = await this.rest< Menu[] >( {
const navMenus = await this.rest< NavigationMenu[] >( {
path: `/wp/v2/navigation/`,
} );

Expand All @@ -93,7 +93,7 @@ export async function deleteAllMenus( this: RequestUtils ) {
);
}

const classicMenus = await this.rest< Menu[] >( {
const classicMenus = await this.rest< NavigationMenu[] >( {
path: `/wp/v2/menus/`,
} );

Expand Down
13 changes: 7 additions & 6 deletions test/e2e/specs/editor/blocks/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,18 @@ test.describe(

await editor.insertBlock( { name: 'core/navigation' } );
// We need to check the canvas after inserting the navigation block to be able to target the block.
const navigationBlock = editor.canvas.locator(
'role=document[name="Block: Navigation"i]'
);
await expect( navigationBlock ).toBeVisible();
await expect.poll( editor.getBlocks ).toMatchObject( [
{
name: 'core/navigation',
},
] );

// Check the block in the canvas.
await editor.page.pause();
await navBlockUtils.selectNavigationItemOnCanvas( 'Home' );
await navBlockUtils.selectNavigationItemOnCanvas( 'Custom link' );

// Check the block in the frontend.
await navBlockUtils.selectNavigationItemOnFrontend( 'Home' );
await navBlockUtils.selectNavigationItemOnFrontend( 'Custom link' );
await editor.page.pause();
} );
}
Expand Down

0 comments on commit 4d4d736

Please sign in to comment.