This commit is contained in:
Karol Manijak 2023-10-16 17:16:07 +02:00 committed by GitHub
parent ce6c7e460a
commit 276556a47c
3 changed files with 13 additions and 33 deletions

View File

@ -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 ];

View File

@ -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>

View File

@ -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,
} ) => {