diff --git a/packages/fiori/cypress/specs/Timeline.cy.tsx b/packages/fiori/cypress/specs/Timeline.cy.tsx index 607dd0508f41..4eababec63ac 100644 --- a/packages/fiori/cypress/specs/Timeline.cy.tsx +++ b/packages/fiori/cypress/specs/Timeline.cy.tsx @@ -512,6 +512,76 @@ describe("Timeline - getFocusDomRef", () => { }); }); +describe("TimelineItem iconTooltip", () => { + it("should render tooltip on the icon when iconTooltip is set", () => { + cy.mount( + + + Deployed successfully. + + + ); + + cy.get("#itemWithTooltip") + .shadow() + .find("[ui5-icon]") + .should("have.attr", "show-tooltip") + .and("exist"); + + cy.get("#itemWithTooltip") + .shadow() + .find("[ui5-icon]") + .should("have.attr", "accessible-name", "Success"); + }); + + it("should not render tooltip on icon when iconTooltip is not set", () => { + cy.mount( + + + Deployed successfully. + + + ); + + cy.get("#itemWithoutTooltip") + .shadow() + .find("[ui5-icon]") + .should("not.have.attr", "show-tooltip"); + }); + + it("should include iconTooltip in the accessible label of the bubble", () => { + cy.mount( + + + Build completed. + + + ); + + cy.get("#itemAccLabel") + .shadow() + .find(".ui5-tli-bubble") + .should("have.attr", "aria-label") + .and("include", "Passed"); + }); +}); + describe("Timeline Header Bar", () => { describe("Search functionality", () => { it("should show header bar when slotted", () => { diff --git a/packages/fiori/src/TimelineItem.ts b/packages/fiori/src/TimelineItem.ts index 77931dcdffb7..e8ce90d0cfae 100644 --- a/packages/fiori/src/TimelineItem.ts +++ b/packages/fiori/src/TimelineItem.ts @@ -69,6 +69,15 @@ class TimelineItem extends UI5Element implements ITimelineItem { @property() icon?: string; + /** + * Defines the tooltip of the graphical icon. + * @default undefined + * @public + * @since 2.22.0 + */ + @property() + iconTooltip?: string; + /** * Defines the name of the item, displayed before the `title-text`. * @default undefined @@ -235,6 +244,10 @@ class TimelineItem extends UI5Element implements ITimelineItem { parts.push(this.timelineItemStateText); } + if (this.iconTooltip) { + parts.push(this.iconTooltip); + } + return parts.join(", "); } } diff --git a/packages/fiori/src/TimelineItemTemplate.tsx b/packages/fiori/src/TimelineItemTemplate.tsx index 9fcdd0e7a651..1f77f4edcc69 100644 --- a/packages/fiori/src/TimelineItemTemplate.tsx +++ b/packages/fiori/src/TimelineItemTemplate.tsx @@ -19,7 +19,13 @@ export default function TimelineItemTemplate(this: TimelineItem) {
{ this.icon ? - + :
} diff --git a/packages/fiori/test/pages/Timeline.html b/packages/fiori/test/pages/Timeline.html index bf528d4b6f89..ec57a7aed7f3 100644 --- a/packages/fiori/test/pages/Timeline.html +++ b/packages/fiori/test/pages/Timeline.html @@ -364,6 +364,33 @@

Advanced Timeline - Horizontal With Groups and Diverse Components

+
+

Timeline with Various Timeline Item States

+
+ + + + Compilation succeeded. + + + Lint completed with minor issues. + + + + + Unit tests failed. + + + Integration tests have warnings. + + + End-to-end tests passed. + + + +
+
+

Timeline with Various Timeline Item States