Skip to content

Commit

Permalink
Template Parts: Decode entities in labels (WordPress#38805)
Browse files Browse the repository at this point in the history
* Template Parts: Decode entities in labels

* Update e2e tests
  • Loading branch information
Mamaduka authored Feb 15, 2022
1 parent cf85dfa commit 47a8adc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/block-library/src/template-part/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { store as coreDataStore } from '@wordpress/core-data';
import { select } from '@wordpress/data';
import { symbolFilled } from '@wordpress/icons';
import { addFilter } from '@wordpress/hooks';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -39,7 +40,9 @@ export const settings = {
return;
}

return startCase( entity.title?.rendered || entity.slug );
return (
decodeEntities( entity.title?.rendered ) || startCase( entity.slug )
);
},
edit,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ describe( 'Multi-entity save flow', () => {
// Select the header template part via list view.
await page.click( '.edit-site-header-toolbar__list-view-toggle' );
const headerTemplatePartListViewButton = await page.waitForXPath(
'//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "Header")]'
'//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "header")]'
);
headerTemplatePartListViewButton.click();
await page.click( 'button[aria-label="Close List View Sidebar"]' );
Expand Down

0 comments on commit 47a8adc

Please sign in to comment.