Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change references to section back to template part #23765

Merged
merged 1 commit into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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