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

Commit

Permalink
Revert #10032 so All Products renders in the frontend (#11263)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmanijak authored and roykho committed Oct 16, 2023
1 parent 7bd5080 commit 97bf32f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 33 deletions.
30 changes: 1 addition & 29 deletions assets/js/blocks/products/all-products/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
className={ getBlockClassName(
'wc-block-all-products',
attributes
) }
{ ...data }
>
<InnerBlocks.Content />
</div>
);
},
};

export default [ v2, v1 ];
export default [ v1 ];
10 changes: 10 additions & 0 deletions assets/js/blocks/products/all-products/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
className={ getBlockClassName(
'wc-block-all-products',
attributes
) }
{ ...data }
>
<InnerBlocks.Content />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand All @@ -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,
} ) => {
Expand Down

0 comments on commit 97bf32f

Please sign in to comment.