From 88c399491938880df83a163b50726c5fbe44f62d Mon Sep 17 00:00:00 2001 From: Noah Allen Date: Tue, 7 Jul 2020 12:36:23 -0700 Subject: [PATCH] Change references to section back to template part (#23765) Renames the "section" block back to "template part" Reverts some changes from https://github.com/WordPress/gutenberg/pull/23295 See https://github.com/WordPress/gutenberg/issues/23657 for reasoning --- .../src/template-part/edit/placeholder/index.js | 8 ++++---- packages/block-library/src/template-part/index.js | 2 +- .../specs/experiments/multi-entity-editing.test.js | 4 ++-- .../specs/experiments/multi-entity-saving.test.js | 7 ++++--- .../e2e-tests/specs/experiments/template-part.test.js | 6 +++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/block-library/src/template-part/edit/placeholder/index.js b/packages/block-library/src/template-part/edit/placeholder/index.js index d63c7d82cf40a2..e15c977cc9a395 100644 --- a/packages/block-library/src/template-part/edit/placeholder/index.js +++ b/packages/block-library/src/template-part/edit/placeholder/index.js @@ -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', @@ -45,9 +45,9 @@ export default function TemplatePartPlaceholder( { setAttributes } ) { return ( ) } diff --git a/packages/block-library/src/template-part/index.js b/packages/block-library/src/template-part/index.js index e98af102838f16..ad2003c16b9f29 100644 --- a/packages/block-library/src/template-part/index.js +++ b/packages/block-library/src/template-part/index.js @@ -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, diff --git a/packages/e2e-tests/specs/experiments/multi-entity-editing.test.js b/packages/e2e-tests/specs/experiments/multi-entity-editing.test.js index 4329496305ee7e..2fb122c59195da 100644 --- a/packages/e2e-tests/specs/experiments/multi-entity-editing.test.js +++ b/packages/e2e-tests/specs/experiments/multi-entity-editing.test.js @@ -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( diff --git a/packages/e2e-tests/specs/experiments/multi-entity-saving.test.js b/packages/e2e-tests/specs/experiments/multi-entity-saving.test.js index 6eb75c58f9a360..b4457ff8450522 100644 --- a/packages/e2e-tests/specs/experiments/multi-entity-saving.test.js +++ b/packages/e2e-tests/specs/experiments/multi-entity-saving.test.js @@ -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 () => { @@ -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 ); @@ -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 diff --git a/packages/e2e-tests/specs/experiments/template-part.test.js b/packages/e2e-tests/specs/experiments/template-part.test.js index 57db9ffd61f838..386b8941c69a01 100644 --- a/packages/e2e-tests/specs/experiments/template-part.test.js +++ b/packages/e2e-tests/specs/experiments/template-part.test.js @@ -90,7 +90,7 @@ 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")]'; @@ -98,7 +98,7 @@ describe( 'Template Part', () => { await createNewPost(); await disablePrePublishChecks(); // Create new template part. - await insertBlock( 'Section' ); + await insertBlock( 'Template Part' ); const [ createNewButton ] = await page.$x( createNewButtonSelector ); @@ -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 );