Skip to content

Commit

Permalink
Change references to section back to template part (#23765)
Browse files Browse the repository at this point in the history
Renames the "section" block back to "template part"

Reverts some changes from #23295

See #23657 for reasoning
  • Loading branch information
noahtallen authored Jul 7, 2020
1 parent f237978 commit 88c3994
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import TemplatePartPreviews from './template-part-previews';
export default function TemplatePartPlaceholder( { setAttributes } ) {
const { saveEntityRecord } = useDispatch( 'core' );
const onCreate = useCallback( async () => {
const title = 'Untitled Section';
const title = 'Untitled Template Part';
const slug = cleanForSlug( title );
const templatePart = await saveEntityRecord(
'postType',
Expand All @@ -45,9 +45,9 @@ export default function TemplatePartPlaceholder( { setAttributes } ) {
return (
<Placeholder
icon={ blockDefault }
label={ __( 'Section' ) }
label={ __( 'Template Part' ) }
instructions={ __(
'Create a new section or pick one from a list of available sections.'
'Create a new template part or pick an existing one from the list.'
) }
>
<Dropdown
Expand All @@ -63,7 +63,7 @@ export default function TemplatePartPlaceholder( { setAttributes } ) {
{ __( 'Choose existing' ) }
</Button>
<Button onClick={ onCreate }>
{ __( 'New section' ) }
{ __( 'New template part' ) }
</Button>
</ButtonGroup>
) }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/template-part/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: __( 'Section' ),
title: __( 'Template Part' ),
keywords: [ __( 'template part' ) ],
__experimentalLabel: ( { slug } ) => startCase( slug ),
edit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const createTemplatePart = async (
isNested = false
) => {
// Create new template part.
await insertBlock( 'Section' );
await insertBlock( 'Template Part' );
const [ createNewButton ] = await page.$x(
'//button[contains(text(), "New section")]'
'//button[contains(text(), "New template part")]'
);
await createNewButton.click();
await page.waitForSelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ describe( 'Multi-entity save flow', () => {
const activatedTemplatePartSelector = `${ templatePartSelector } .block-editor-inner-blocks`;
const savePanelSelector = '.entities-saved-states__panel';
const closePanelButtonSelector = 'button[aria-label="Close panel"]';
const createNewButtonSelector = '//button[contains(text(), "New section")]';
const createNewButtonSelector =
'//button[contains(text(), "New template part")]';

// Reusable assertions across Post/Site editors.
const assertAllBoxesChecked = async () => {
Expand Down Expand Up @@ -108,7 +109,7 @@ describe( 'Multi-entity save flow', () => {

it( 'Should trigger multi-entity save button once template part edited', async () => {
// Create new template part.
await insertBlock( 'Section' );
await insertBlock( 'Template Part' );
const [ createNewButton ] = await page.$x(
createNewButtonSelector
);
Expand Down Expand Up @@ -234,7 +235,7 @@ describe( 'Multi-entity save flow', () => {
await demoTemplateButton.click();

// Insert a new template part placeholder.
await insertBlock( 'Section' );
await insertBlock( 'Template Part' );

const enabledButton = await page.waitForSelector(
activeSaveSiteSelector
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e-tests/specs/experiments/template-part.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ describe( 'Template Part', () => {
const activatedTemplatePartSelector = `${ templatePartSelector } .block-editor-inner-blocks`;
const testContentSelector = `//p[contains(., "${ testContent }")]`;
const createNewButtonSelector =
'//button[contains(text(), "New section")]';
'//button[contains(text(), "New template part")]';
const chooseExistingButtonSelector =
'//button[contains(text(), "Choose existing")]';

it( 'Should insert new template part on creation', async () => {
await createNewPost();
await disablePrePublishChecks();
// Create new template part.
await insertBlock( 'Section' );
await insertBlock( 'Template Part' );
const [ createNewButton ] = await page.$x(
createNewButtonSelector
);
Expand All @@ -120,7 +120,7 @@ describe( 'Template Part', () => {
it( 'Should preview newly added template part', async () => {
await createNewPost();
// Try to insert the template part we created.
await insertBlock( 'Section' );
await insertBlock( 'Template Part' );
const [ chooseExistingButton ] = await page.$x(
chooseExistingButtonSelector
);
Expand Down

0 comments on commit 88c3994

Please sign in to comment.