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 "Swap" to "Replace" for Template Action #68234

Open
wants to merge 20 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
63f81c1
Image size fix in lightbox
karthick-murugan Dec 3, 2024
0e19583
Revert "Image size fix in lightbox"
karthick-murugan Dec 3, 2024
f226ae0
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 4, 2024
d074ba9
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 5, 2024
4d847ca
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 5, 2024
c9115b2
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 5, 2024
b81e6ff
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 6, 2024
efe57e5
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 9, 2024
228e924
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 10, 2024
c448a21
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 11, 2024
05bb54c
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 12, 2024
619fed3
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 12, 2024
301d70f
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 18, 2024
c80640f
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 19, 2024
6ed9ff3
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 20, 2024
09b4cf2
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 20, 2024
27e4bbc
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 20, 2024
52f809e
Merge branch 'WordPress:trunk' into trunk
karthick-murugan Dec 23, 2024
449f398
Rename template action
karthick-murugan Dec 23, 2024
fa54cee
End-to-End Tests Updates
karthick-murugan Jan 8, 2025
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 @@ -37,7 +37,7 @@ export default function SwapTemplateButton( { onClick } ) {
return (
<>
<MenuItem onClick={ () => setShowModal( true ) }>
{ __( 'Swap template' ) }
{ __( 'Replace template' ) }
</MenuItem>
{ showModal && (
<Modal
Expand Down
2 changes: 1 addition & 1 deletion packages/fields/src/fields/template/template-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const TemplateEdit = ( {
onToggle();
} }
>
{ __( 'Swap template' ) }
{ __( 'Replace template' ) }
</MenuItem>
{
// The default template in a post is indicated by an empty string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test.describe( 'Post Editor Template mode', () => {
).toBeVisible();
} );

test( 'Swap templates and proper template resolution when switching to default template', async ( {
test( 'Replace templates and proper template resolution when switching to default template', async ( {
editor,
page,
requestUtils,
Expand All @@ -88,10 +88,10 @@ test.describe( 'Post Editor Template mode', () => {
await page.reload();
await postEditorTemplateMode.disableTemplateWelcomeGuide();
await postEditorTemplateMode.openTemplatePopover();
// Swap to a custom template, save and reload.
// Replace to a custom template, save and reload.
await page
.getByRole( 'menuitem', {
name: 'Swap template',
name: 'Replace template',
} )
.click();
await page
Expand All @@ -101,7 +101,7 @@ test.describe( 'Post Editor Template mode', () => {
.click();
await editor.saveDraft();
await page.reload();
// Swap to the default template.
// Replace to the default template.
await postEditorTemplateMode.openTemplatePopover();
await page
.getByRole( 'menuitem', {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/site-editor/pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ test.describe( 'Pages', () => {
await templateOptionsButton.click();
await page
.getByRole( 'menu', { name: 'Template options' } )
.getByText( 'Swap template' )
.getByText( 'Replace template' )
.click();
const templateItem = page.locator(
'.block-editor-block-patterns-list__item-title'
Expand All @@ -305,7 +305,7 @@ test.describe( 'Pages', () => {
await expect( templateOptionsButton ).toHaveText( 'Single Entries' );
} );

test( 'swap template options should respect the declared `postTypes`', async ( {
test( 'replace template options should respect the declared `postTypes`', async ( {
page,
editor,
} ) => {
Expand All @@ -321,7 +321,7 @@ test.describe( 'Pages', () => {
await expect(
page
.getByRole( 'menu', { name: 'Template options' } )
.getByText( 'Swap template' )
.getByText( 'Replace template' )
).toHaveCount( 0 );
} );
} );
14 changes: 9 additions & 5 deletions test/e2e/specs/site-editor/template-registration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test.describe( 'Block template registration', () => {
).toBeHidden();
} );

test( 'registered templates are available in the Swap template screen', async ( {
test( 'registered templates are available in the Replace template screen', async ( {
admin,
editor,
page,
Expand All @@ -106,10 +106,12 @@ test.describe( 'Block template registration', () => {
attributes: { content: 'User-created post.' },
} );

// Swap template.
// Replace template.
await page.getByRole( 'button', { name: 'Post', exact: true } ).click();
await page.getByRole( 'button', { name: 'Template options' } ).click();
await page.getByRole( 'menuitem', { name: 'Swap template' } ).click();
await page
.getByRole( 'menuitem', { name: 'Replace template' } )
.click();
await page.getByText( 'Plugin Template' ).click();

// Verify the template is applied.
Expand All @@ -133,10 +135,12 @@ test.describe( 'Block template registration', () => {
attributes: { content: 'User-created post.' },
} );

// Swap template.
// Replace template.
await page.getByRole( 'button', { name: 'Post', exact: true } ).click();
await page.getByRole( 'button', { name: 'Template options' } ).click();
await page.getByRole( 'menuitem', { name: 'Swap template' } ).click();
await page
.getByRole( 'menuitem', { name: 'Replace template' } )
.click();
await page.getByText( 'Custom', { exact: true } ).click();

// Verify the theme template is applied.
Expand Down
Loading