CYS: show logo when the header is updated (#49681)

* CYS: show logo when the header is updated

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-07-19 10:03:56 +02:00 committed by GitHub
parent d0bd9f193a
commit 1a7619a4fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 47 additions and 9 deletions

View File

@ -338,16 +338,14 @@ export const useAddAutoBlockPreviewEventListenersAndObservers = (
setStyle( documentElement ); setStyle( documentElement );
if ( logoBlockIds.length === 0 ) { const logoObserver = findAndSetLogoBlock(
const logoObserver = findAndSetLogoBlock( { autoScale, documentElement },
{ autoScale, documentElement }, {
{ setLogoBlockIds,
setLogoBlockIds, }
} );
);
observers.push( logoObserver ); observers.push( logoObserver );
}
if ( if (
isFullComposabilityFeatureAndAPIAvailable() && isFullComposabilityFeatureAndAPIAvailable() &&

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
CYS: show logo when the header is updated.

View File

@ -49,6 +49,10 @@ export class LogoPickerPage {
.click(); .click();
} }
getPlaceholderPreview( assemblerLocator ) {
return assemblerLocator.locator( '.components-placeholder__preview' );
}
async resetLogo( baseURL ) { async resetLogo( baseURL ) {
const apiContext = await this.request.newContext( { const apiContext = await this.request.newContext( {
baseURL, baseURL,

View File

@ -187,6 +187,38 @@ test.describe( 'Assembler -> Logo Picker', { tag: '@gutenberg' }, () => {
await expect( assembler.getByText( 'Media Library' ) ).toBeVisible(); await expect( assembler.getByText( 'Media Library' ) ).toBeVisible();
} ); } );
// This test checks this regression: https://github.com/woocommerce/woocommerce/issues/49668
test( 'Logo should be visible after header update', async ( {
assemblerPageObject,
logoPickerPageObject,
} ) => {
const assembler = await assemblerPageObject.getAssembler();
const emptyLogoPicker =
logoPickerPageObject.getEmptyLogoPickerLocator( assembler );
await emptyLogoPicker.click();
await logoPickerPageObject.pickImage( assembler );
await assembler.getByLabel( 'Back' ).click();
await assembler.getByText( 'Choose your header' ).click();
const header = assembler
.locator( '.block-editor-block-patterns-list__list-item' )
.nth( 1 )
.frameLocator( 'iframe' )
.locator( '.wc-blocks-header-pattern' );
await header.click();
await assembler.getByLabel( 'Back' ).click();
await assembler.getByText( 'Add your logo' ).click();
const emptyLogoLocator =
logoPickerPageObject.getPlaceholderPreview( assembler );
await expect( emptyLogoLocator ).toBeHidden();
} );
test( 'Enabling the "use as site icon" option should set the image as the site icon', async ( { test( 'Enabling the "use as site icon" option should set the image as the site icon', async ( {
page, page,
assemblerPageObject, assemblerPageObject,