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

Revert #10032 so All Products renders in the frontend #11263

Merged
merged 1 commit into from
Oct 16, 2023
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
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
Loading