From c0c2d2a79db33bf969b2fb8a42364c3f54a06b93 Mon Sep 17 00:00:00 2001 From: Dobrin Dimchev Date: Thu, 18 Sep 2025 15:14:37 +0300 Subject: [PATCH] fix(ui5-shellbar-item): correct getFocusDomRef return value --- .../fiori/cypress/specs/ShellBarItem.cy.tsx | 62 +++++++++++++++++++ packages/fiori/src/ShellBar.ts | 2 +- .../fiori/src/ShellBarPopoverTemplate.tsx | 1 + packages/fiori/src/ShellBarTemplate.tsx | 2 +- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 packages/fiori/cypress/specs/ShellBarItem.cy.tsx diff --git a/packages/fiori/cypress/specs/ShellBarItem.cy.tsx b/packages/fiori/cypress/specs/ShellBarItem.cy.tsx new file mode 100644 index 000000000000..005e1759b1ea --- /dev/null +++ b/packages/fiori/cypress/specs/ShellBarItem.cy.tsx @@ -0,0 +1,62 @@ +import ShellBar from "../../src/ShellBar.js"; +import ShellBarItem from "../../src/ShellBarItem.js"; +import Button from "@ui5/webcomponents/dist/Button.js"; +import Avatar from "@ui5/webcomponents/dist/Avatar.js"; +import Input from "@ui5/webcomponents/dist/Input.js"; + +describe("ShellBarItem getFocusDomRef", () => { + it("should return the correct DOM element when item is in the bar", () => { + cy.mount( + + + + ); + + cy.get("#item1") + .then(($item) => { + const focusRef = $item[0].getFocusDomRef(); + expect(focusRef).to.be.instanceOf(HTMLElement); + expect(focusRef).has.attr('ui5-button'); + expect(focusRef?.getAttribute('data-ui5-stable')).to.equal('item-1'); + }); + }); + + it("should return the correct DOM element when item is in overflow popover", () => { + cy.mount( + +