Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Rename templates to more e-commerce friendly names #5935

Merged
merged 3 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions src/Utils/BlockTemplateUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ public static function convert_slug_to_title( $template_slug ) {
case 'single-product':
return __( 'Single Product', 'woo-gutenberg-products-block' );
case 'archive-product':
return __( 'Product Archive', 'woo-gutenberg-products-block' );
return __( 'Product Catalog', 'woo-gutenberg-products-block' );
case 'taxonomy-product_cat':
return __( 'Product Category', 'woo-gutenberg-products-block' );
return __( 'Products by Category', 'woo-gutenberg-products-block' );
case 'taxonomy-product_tag':
return __( 'Product Tag', 'woo-gutenberg-products-block' );
return __( 'Products by Tag', 'woo-gutenberg-products-block' );
default:
// Replace all hyphens and underscores with spaces.
return ucwords( preg_replace( '/[\-_]/', ' ', $template_slug ) );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Store Editing Templates Product Archive block template should contain the "WooCommerce Product Archive Block" legacy template 1`] = `
exports[`Store Editing Templates Product Catalog block template should contain the "WooCommerce Product Grid Block" legacy template 1`] = `
"<!-- wp:template-part {\\"slug\\":\\"header\\",\\"theme\\":\\"emptytheme\\"} /-->

<!-- wp:group {\\"layout\\":{\\"inherit\\":true}} -->
Expand All @@ -10,7 +10,7 @@ exports[`Store Editing Templates Product Archive block template should contain t
<!-- wp:template-part {\\"slug\\":\\"footer\\",\\"theme\\":\\"emptytheme\\"} /-->"
`;

exports[`Store Editing Templates Product Category block template should contain the "WooCommerce Product Taxonomy Block" legacy template 1`] = `
exports[`Store Editing Templates Product by Category block template should contain the "WooCommerce Product Taxonomy Block" legacy template 1`] = `
"<!-- wp:template-part {\\"slug\\":\\"header\\",\\"theme\\":\\"emptytheme\\"} /-->

<!-- wp:group {\\"layout\\":{\\"inherit\\":true}} -->
Expand All @@ -20,7 +20,7 @@ exports[`Store Editing Templates Product Category block template should contain
<!-- wp:template-part {\\"slug\\":\\"footer\\",\\"theme\\":\\"emptytheme\\"} /-->"
`;

exports[`Store Editing Templates Product Tag block template should contain the "WooCommerce Product Taxonomy Block" legacy template 1`] = `
exports[`Store Editing Templates Products by Tag block template should contain the "WooCommerce Product Taxonomy Block" legacy template 1`] = `
"<!-- wp:template-part {\\"slug\\":\\"header\\",\\"theme\\":\\"emptytheme\\"} /-->

<!-- wp:group {\\"layout\\":{\\"inherit\\":true}} -->
Expand Down
20 changes: 10 additions & 10 deletions tests/e2e/specs/backend/site-editing-templates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ describe( 'Store Editing Templates', () => {
} );
} );

describe( 'Product Archive block template', () => {
describe( 'Product Catalog block template', () => {
it( 'default template from WooCommerce Blocks is available on an FSE theme', async () => {
const EXPECTED_TEMPLATE = defaultTemplateProps( 'Product Archive' );
const EXPECTED_TEMPLATE = defaultTemplateProps( 'Product Catalog' );

await goToSiteEditor( '?postType=wp_template' );

Expand All @@ -234,7 +234,7 @@ describe( 'Store Editing Templates', () => {
}
} );

it( 'should contain the "WooCommerce Product Archive Block" legacy template', async () => {
it( 'should contain the "WooCommerce Product Grid Block" legacy template', async () => {
const templateQuery = addQueryArgs( '', {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
Expand All @@ -255,7 +255,7 @@ describe( 'Store Editing Templates', () => {

it( 'should show the action menu if the template has been customized by the user', async () => {
const EXPECTED_TEMPLATE = {
...defaultTemplateProps( 'Product Archive' ),
...defaultTemplateProps( 'Product Catalog' ),
hasActions: true,
};

Expand Down Expand Up @@ -308,10 +308,10 @@ describe( 'Store Editing Templates', () => {
} );
} );

describe( 'Product Category block template', () => {
describe( 'Product by Category block template', () => {
it( 'default template from WooCommerce Blocks is available on an FSE theme', async () => {
const EXPECTED_TEMPLATE = defaultTemplateProps(
'Product Category'
'Products by Category'
);

await goToSiteEditor( '?postType=wp_template' );
Expand Down Expand Up @@ -353,7 +353,7 @@ describe( 'Store Editing Templates', () => {

it( 'should show the action menu if the template has been customized by the user', async () => {
const EXPECTED_TEMPLATE = {
...defaultTemplateProps( 'Product Category' ),
...defaultTemplateProps( 'Products by Category' ),
hasActions: true,
};

Expand Down Expand Up @@ -402,9 +402,9 @@ describe( 'Store Editing Templates', () => {
} );
} );

describe( 'Product Tag block template', () => {
describe( 'Products by Tag block template', () => {
it( 'default template from WooCommerce Blocks is available on an FSE theme', async () => {
const EXPECTED_TEMPLATE = defaultTemplateProps( 'Product Tag' );
const EXPECTED_TEMPLATE = defaultTemplateProps( 'Products by Tag' );

await goToSiteEditor( '?postType=wp_template' );

Expand Down Expand Up @@ -445,7 +445,7 @@ describe( 'Store Editing Templates', () => {

it( 'should show the action menu if the template has been customized by the user', async () => {
const EXPECTED_TEMPLATE = {
...defaultTemplateProps( 'Product Tag' ),
...defaultTemplateProps( 'Products by Tag' ),
hasActions: true,
};

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/frontend/legacy-template-blocks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe( 'Legacy Template blocks', () => {
} );
} );

describe( 'Product Category block', () => {
describe( 'Product by Category block', () => {
sunyatasattva marked this conversation as resolved.
Show resolved Hide resolved
it( 'renders a list of products with their count, pagination and the category title', async () => {
const CATEGORY_NAME = 'Uncategorized';
const { productArchivePage } = SELECTORS;
Expand Down Expand Up @@ -112,7 +112,7 @@ describe( 'Legacy Template blocks', () => {
} );
} );

describe( 'Product Tag block', () => {
describe( 'Products by Tag block', () => {
it( 'renders a list of products with their count, pagination and the tag title', async () => {
const TAG_NAME = 'Newest';
const { productArchivePage } = SELECTORS;
Expand Down