Skip to content

Commit

Permalink
Navigation Block: De-emphasize "Link" block. (#30172)
Browse files Browse the repository at this point in the history
* Navigation Block: De-emphasize "Link" block.

* Try: Fix tests.

* Fix tests.

* Another test.
  • Loading branch information
jasmussen authored Mar 25, 2021
1 parent fd0daed commit b93d0dc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const fallbackVariations = [
{
name: 'link',
isDefault: true,
title: __( 'Link' ),
description: __( 'A link to a URL.' ),
title: __( 'Custom Link' ),
description: __( 'A link to a custom URL.' ),
attributes: {},
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation-link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Link', 'block title' ),
title: _x( 'Custom Link', 'block title' ),

icon: linkIcon,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Object {
"variations": Array [
Object {
"attributes": Object {},
"description": "A link to a URL.",
"description": "A link to a custom URL.",
"isActive": [Function],
"isDefault": true,
"name": "link",
"title": "Link",
"title": "Custom Link",
},
Object {
"attributes": Object {
Expand Down Expand Up @@ -96,7 +96,7 @@ Object {
"variations": Array [
Object {
"attributes": Object {},
"description": "A link to a URL.",
"description": "A link to a custom URL.",
"icon": <SVG
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -107,7 +107,7 @@ Object {
</SVG>,
"isActive": [Function],
"name": "link",
"title": "Link",
"title": "Custom Link",
},
Object {
"attributes": Object {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation-link/test/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ describe( 'hooks', () => {
variations: [
{
name: 'link',
title: __( 'Link' ),
description: __( 'A link to a URL.' ),
title: __( 'Custom Link' ),
description: __( 'A link to a custom URL.' ),
attributes: {},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async function addLinkBlock() {
await page.click( '.wp-block-navigation .block-list-appender' );

const [ linkButton ] = await page.$x(
"//*[contains(@class, 'block-editor-inserter__quick-inserter')]//*[text()='Link']"
"//*[contains(@class, 'block-editor-inserter__quick-inserter')]//*[text()='Custom Link']"
);
await linkButton.click();
}
Expand Down Expand Up @@ -323,7 +323,7 @@ describe( 'Navigation', () => {
// Scope element selector to the Editor's "Content" region as otherwise it picks up on
// block previews.
const navBlockItemsLength = await page.$$eval(
'[aria-label="Editor content"][role="region"] li[aria-label="Block: Link"]',
'[aria-label="Editor content"][role="region"] li[aria-label="Block: Custom Link"]',
( els ) => els.length
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ describe( 'Navigation editor', () => {

// Select a link block with nested links in a submenu.
const parentLinkXPath =
'//li[@aria-label="Block: Link" and contains(.,"WordPress.org")]';
'//li[@aria-label="Block: Custom Link" and contains(.,"WordPress.org")]';
const linkBlock = await page.waitForXPath( parentLinkXPath );
await linkBlock.click();

Expand All @@ -311,7 +311,7 @@ describe( 'Navigation editor', () => {
// Submenus are hidden using `visibility: hidden` and shown using
// `visibility: visible` so the visible/hidden options must be used
// when selecting the elements.
const submenuLinkXPath = `${ parentLinkXPath }//li[@aria-label="Block: Link"]`;
const submenuLinkXPath = `${ parentLinkXPath }//li[@aria-label="Block: Custom Link"]`;
const submenuLinkVisible = await page.waitForXPath( submenuLinkXPath, {
visible: true,
} );
Expand Down Expand Up @@ -352,10 +352,8 @@ describe( 'Navigation editor', () => {
);
await appender.click();

// Must be an exact match to the word 'Link' as other
// variations also contain the word 'Link'.
const linkInserterItem = await page.waitForXPath(
'//button[@role="option"]//span[.="Link"]'
'//button[@role="option"]//span[.="Custom Link"]'
);
await linkInserterItem.click();

Expand Down

0 comments on commit b93d0dc

Please sign in to comment.