From 9f6da399dd05d5ee2c6639934b395b21f07318a4 Mon Sep 17 00:00:00 2001
From: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
Date: Mon, 16 Oct 2023 16:14:30 +0200
Subject: [PATCH] Revert #10032 so All Products renders in the frontend
---
.../products/all-products/deprecated.js | 30 +------------------
.../js/blocks/products/all-products/save.js | 10 +++++++
...ce-filter.block_theme.side_effects.spec.ts | 6 ++--
3 files changed, 13 insertions(+), 33 deletions(-)
diff --git a/assets/js/blocks/products/all-products/deprecated.js b/assets/js/blocks/products/all-products/deprecated.js
index 48e118f3c60..5a5aadbf684 100644
--- a/assets/js/blocks/products/all-products/deprecated.js
+++ b/assets/js/blocks/products/all-products/deprecated.js
@@ -33,32 +33,4 @@ const v1 = {
},
};
-const v2 = {
- attributes: Object.assign( {}, attributeDefinitions, {
- rows: { type: 'number', default: 1 },
- } ),
- save( { attributes } ) {
- const dataAttributes = {};
- Object.keys( attributes )
- .sort()
- .forEach( ( key ) => {
- dataAttributes[ key ] = attributes[ key ];
- } );
- const data = {
- 'data-attributes': JSON.stringify( dataAttributes ),
- };
- return (
-
-
-
- );
- },
-};
-
-export default [ v2, v1 ];
+export default [ v1 ];
diff --git a/assets/js/blocks/products/all-products/save.js b/assets/js/blocks/products/all-products/save.js
index 6f620e64e97..108ae322d63 100644
--- a/assets/js/blocks/products/all-products/save.js
+++ b/assets/js/blocks/products/all-products/save.js
@@ -9,12 +9,22 @@ import { InnerBlocks } from '@wordpress/block-editor';
import { getBlockClassName } from '../utils.js';
export default function save( { attributes } ) {
+ const dataAttributes = {};
+ Object.keys( attributes )
+ .sort()
+ .forEach( ( key ) => {
+ dataAttributes[ key ] = attributes[ key ];
+ } );
+ const data = {
+ 'data-attributes': JSON.stringify( dataAttributes ),
+ };
return (
diff --git a/tests/e2e/tests/price-filter/price-filter.block_theme.side_effects.spec.ts b/tests/e2e/tests/price-filter/price-filter.block_theme.side_effects.spec.ts
index 5bd60eadbfe..a2b90f1d27a 100644
--- a/tests/e2e/tests/price-filter/price-filter.block_theme.side_effects.spec.ts
+++ b/tests/e2e/tests/price-filter/price-filter.block_theme.side_effects.spec.ts
@@ -42,8 +42,7 @@ test.describe( `${ blockData.name } Block - with All products Block`, () => {
await page.goto( `/?p=${ postId }`, { waitUntil: 'commit' } );
} );
- // eslint-disable-next-line playwright/no-skipped-test
- test.skip( 'should show all products', async ( { frontendUtils } ) => {
+ test( 'should show all products', async ( { frontendUtils } ) => {
const allProductsBlock = await frontendUtils.getBlockByName(
'woocommerce/all-products'
);
@@ -60,8 +59,7 @@ test.describe( `${ blockData.name } Block - with All products Block`, () => {
expect( products ).toHaveLength( 9 );
} );
- // eslint-disable-next-line playwright/no-skipped-test
- test.skip( 'should show only products that match the filter', async ( {
+ test( 'should show only products that match the filter', async ( {
page,
frontendUtils,
} ) => {