diff --git a/packages/fiori/cypress/specs/ShellBar.cy.tsx b/packages/fiori/cypress/specs/ShellBar.cy.tsx index cc1a64597b7a..14d2bfb30caf 100644 --- a/packages/fiori/cypress/specs/ShellBar.cy.tsx +++ b/packages/fiori/cypress/specs/ShellBar.cy.tsx @@ -321,6 +321,37 @@ describe("Responsiveness", () => { }); describe("Slots", () => { + describe("Profile slot", () => { + it("forwards click from shellbar profile button to slotted avatar (mount pattern)", () => { + const clickSpy = cy.spy().as("avatarClickSpy"); + const profileClickSpy = cy.spy().as("profileClickSpy"); + + cy.mount( +
+ + + +
+ ); + + cy.get("#test-avatar").then($el => { + $el[0].addEventListener("ui5-click", clickSpy); + }); + cy.get("#test-shellbar").then($el => { + $el[0].addEventListener("ui5-profile-click", profileClickSpy); + }); + + cy.get("#test-shellbar").shadow().find(".ui5-shellbar-image-button").realClick(); + cy.get("@profileClickSpy").should("have.been.calledOnce"); + cy.get("@avatarClickSpy").should("have.been.calledOnce"); + }); + }); + describe("Content slot", () => { it("Test separators visibility", () => { function assertStartSeparatorVisibility(expectedExist: boolean) { diff --git a/packages/fiori/src/themes/ShellBar.css b/packages/fiori/src/themes/ShellBar.css index 33c9322b5550..3ec8c65a7b54 100644 --- a/packages/fiori/src/themes/ShellBar.css +++ b/packages/fiori/src/themes/ShellBar.css @@ -114,7 +114,6 @@ slot[name="profile"] { height: 2rem; min-width: 0; min-height: 2rem; - pointer-events: none; font-size: var(--_ui5_avatar_fontsize_XS); font-weight: normal; } diff --git a/packages/fiori/test/specs/ShellBar.spec.js b/packages/fiori/test/specs/ShellBar.spec.js index 88da047c01e2..932aade34f52 100644 --- a/packages/fiori/test/specs/ShellBar.spec.js +++ b/packages/fiori/test/specs/ShellBar.spec.js @@ -132,6 +132,11 @@ describe("Component Behavior", () => { const profileIcon = await browser.$("#shellbar").shadow$("[data-profile-btn]"); const input = await browser.$("#press-input"); + await browser.waitUntil(() => profileIcon.shadow(".ui5-button-root"), { + timeout: 500, + timeoutMsg: "Profile button is ready to be clicked" + }); + await profileIcon.click(); assert.strictEqual(await input.getValue(), "Profile", "Input value is set by click event of Profile"); }); @@ -230,6 +235,12 @@ describe("Component Behavior", () => { const input = await browser.$("#press-input"); await profileIcon.click(); + + await browser.waitUntil(async () => (await input.getProperty("value")) === "Profile", { + timeout: 500, + timeoutMsg: "Input value ready to be asserted." + }); + assert.strictEqual(await input.getValue(), "Profile", "Input value is set by click event of Profile"); }); diff --git a/packages/main/src/themes/Button.css b/packages/main/src/themes/Button.css index 511decc726b3..2b244280ff58 100644 --- a/packages/main/src/themes/Button.css +++ b/packages/main/src/themes/Button.css @@ -117,6 +117,7 @@ content: ""; position: absolute; box-sizing: border-box; + pointer-events: none; left: 0.0625rem; top: 0.0625rem; right: 0.0625rem;