Fix sidebar attribute control in Products by Attribute block (#49351)
* Fix sidebar attribute control in Products by Attribute block * Add changelog file * Linting
This commit is contained in:
parent
fa82f493f1
commit
ec95afc178
|
@ -61,7 +61,7 @@ export const ProductsByAttributeInspectorControls = (
|
|||
selected={ attributes }
|
||||
onChange={ ( value = [] ) => {
|
||||
const result = value.map(
|
||||
( { id, attr_slug: attributeSlug } ) => ( {
|
||||
( { id, value: attributeSlug } ) => ( {
|
||||
id,
|
||||
attr_slug: attributeSlug,
|
||||
} )
|
||||
|
|
|
@ -28,4 +28,28 @@ test.describe( `${ blockData.slug } Block`, () => {
|
|||
blockLocatorFrontend.getByRole( 'listitem' )
|
||||
).toHaveCount( 9 );
|
||||
} );
|
||||
|
||||
test( 'can change attributes from the sidebar', async ( {
|
||||
editor,
|
||||
admin,
|
||||
frontendUtils,
|
||||
page,
|
||||
} ) => {
|
||||
await admin.createNewPost();
|
||||
await editor.insertBlock( { name: blockData.slug } );
|
||||
const blockLocator = await editor.getBlockByName( blockData.slug );
|
||||
await blockLocator.getByText( 'Color' ).click();
|
||||
await blockLocator.getByText( 'Done' ).click();
|
||||
await page.getByText( 'Filter by Product Attribute' ).click();
|
||||
await page.getByText( 'Color' ).click();
|
||||
await page.getByText( 'Size' ).click();
|
||||
await expect( blockLocator.getByRole( 'listitem' ) ).toHaveCount( 1 );
|
||||
await editor.publishAndVisitPost();
|
||||
const blockLocatorFrontend = await frontendUtils.getBlockByName(
|
||||
blockData.slug
|
||||
);
|
||||
await expect(
|
||||
blockLocatorFrontend.getByRole( 'listitem' )
|
||||
).toHaveCount( 1 );
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix sidebar attribute control in Products by Attribute block
|
Loading…
Reference in New Issue