Skip to content

Commit d338957

Browse files
fix(ui5-shellbar): image button is now properly read
1 parent edd48d4 commit d338957

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/fiori/cypress/specs/ShellBar.cy.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,38 @@ describe("Component Behavior", () => {
13961396
.find("button")
13971397
.should("have.attr", "aria-haspopup", NOTIFICATIONS_BTN_ARIA_HASPOPUP);
13981398
});
1399+
1400+
it("tests imageBtnText logical OR fallback - uses default i18n text when no custom text provided", () => {
1401+
cy.mount(
1402+
<ShellBar>
1403+
<img src="https://upload.wikimedia.org/wikipedia/commons/5/59/SAP_2011_logo.svg" slot="profile" />
1404+
</ShellBar>
1405+
);
1406+
1407+
// When no aria-label is provided, imageBtnText should fallback to SHELLBAR_IMAGE_BTN i18n text
1408+
cy.get("[ui5-shellbar]").should("have.prop", "imageBtnText", "Profile Menu");
1409+
});
1410+
1411+
it("tests SHELLBAR_IMAGE_BTN i18n key is properly used as fallback", () => {
1412+
cy.mount(
1413+
<ShellBar>
1414+
<Avatar slot="profile" icon="customer" />
1415+
</ShellBar>
1416+
);
1417+
1418+
// Verify that the exact i18n text from SHELLBAR_IMAGE_BTN is used
1419+
cy.get("[ui5-shellbar]").then(($shellbar) => {
1420+
const imageBtnText = $shellbar.prop("imageBtnText");
1421+
// This should be exactly "Profile Menu" from messagebundle.properties SHELLBAR_IMAGE_BTN
1422+
expect(imageBtnText).to.equal("Profile Menu");
1423+
});
1424+
1425+
// Verify the profile button actually uses this text in its aria-label
1426+
cy.get("[ui5-shellbar]")
1427+
.shadow()
1428+
.find(".ui5-shellbar-image-button")
1429+
.should("have.attr", "aria-label", "Profile Menu");
1430+
});
13991431
});
14001432

14011433
describe("ui5-shellbar menu", () => {

0 commit comments

Comments
 (0)