Revert woocommerce/woocommerce-blocks#10032 so All Products renders in the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/11263)
This commit is contained in:
parent
ce6c7e460a
commit
276556a47c
|
@ -33,32 +33,4 @@ const v1 = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const v2 = {
|
export default [ v1 ];
|
||||||
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 ];
|
|
||||||
|
|
|
@ -9,12 +9,22 @@ import { InnerBlocks } from '@wordpress/block-editor';
|
||||||
import { getBlockClassName } from '../utils.js';
|
import { getBlockClassName } from '../utils.js';
|
||||||
|
|
||||||
export default function save( { attributes } ) {
|
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 (
|
return (
|
||||||
<div
|
<div
|
||||||
className={ getBlockClassName(
|
className={ getBlockClassName(
|
||||||
'wc-block-all-products',
|
'wc-block-all-products',
|
||||||
attributes
|
attributes
|
||||||
) }
|
) }
|
||||||
|
{ ...data }
|
||||||
>
|
>
|
||||||
<InnerBlocks.Content />
|
<InnerBlocks.Content />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -42,8 +42,7 @@ test.describe( `${ blockData.name } Block - with All products Block`, () => {
|
||||||
await page.goto( `/?p=${ postId }`, { waitUntil: 'commit' } );
|
await page.goto( `/?p=${ postId }`, { waitUntil: 'commit' } );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
test( 'should show all products', async ( { frontendUtils } ) => {
|
||||||
test.skip( 'should show all products', async ( { frontendUtils } ) => {
|
|
||||||
const allProductsBlock = await frontendUtils.getBlockByName(
|
const allProductsBlock = await frontendUtils.getBlockByName(
|
||||||
'woocommerce/all-products'
|
'woocommerce/all-products'
|
||||||
);
|
);
|
||||||
|
@ -60,8 +59,7 @@ test.describe( `${ blockData.name } Block - with All products Block`, () => {
|
||||||
expect( products ).toHaveLength( 9 );
|
expect( products ).toHaveLength( 9 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
test( 'should show only products that match the filter', async ( {
|
||||||
test.skip( 'should show only products that match the filter', async ( {
|
|
||||||
page,
|
page,
|
||||||
frontendUtils,
|
frontendUtils,
|
||||||
} ) => {
|
} ) => {
|
||||||
|
|
Loading…
Reference in New Issue