Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions packages/main/cypress/specs/DatePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,106 @@ describe("Date Picker Tests", () => {
.ui5DatePickerGetInnerInput()
.should("have.value", "0202-12-01");
});

it("DatePicker icon shows correct tooltip when closed", () => {
cy.mount(<DatePicker />);

cy.get("[ui5-date-picker]")
.as("datePicker")
.should("not.have.attr", "open");

cy.get("@datePicker")
.shadow()
.find("ui5-icon")
.should("have.attr", "accessible-name", "Open Picker");
});

it("DatePicker icon shows correct tooltip when opened", () => {
cy.mount(<DatePicker />);

cy.get("[ui5-date-picker]")
.as("datePicker")
.ui5DatePickerValueHelpIconPress();

cy.get("@datePicker")
.should("have.attr", "open");

cy.get("@datePicker")
.shadow()
.find("ui5-icon")
.should("have.attr", "accessible-name", "Close Picker");
});

it("DatePicker icon tooltip changes when toggling picker", () => {
Copy link
Contributor

@unazko unazko Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we have the same redundancy in the tests as in the time picker pr. Test three covers the scenarios of tests one and two. Opening the value help with keyboard combinations would also hit the same logic and it would be expected to do so in the future as well. Even though I suppose we can leave test four for now.

cy.mount(<DatePicker />);

cy.get("[ui5-date-picker]")
.as("datePicker");

cy.get("@datePicker")
.should("not.have.attr", "open");

cy.get("@datePicker")
.shadow()
.find("ui5-icon")
.as("icon")
.should("have.attr", "accessible-name", "Open Picker");

cy.get("@datePicker")
.ui5DatePickerValueHelpIconPress();

cy.get("@datePicker")
.should("have.attr", "open");

cy.get("@icon")
.should("have.attr", "accessible-name", "Close Picker");

cy.get("@datePicker")
.ui5DatePickerValueHelpIconPress();

cy.get("@datePicker")
.should("not.have.attr", "open");

cy.get("@icon")
.should("have.attr", "accessible-name", "Open Picker");
});

it("DatePicker icon tooltip changes when using keyboard shortcuts", () => {
cy.mount(<DatePicker />);

cy.get("[ui5-date-picker]")
.as("datePicker")
.ui5DatePickerGetInnerInput()
.as("input")
.realClick()
.should("be.focused");

cy.get("@datePicker")
.shadow()
.find("ui5-icon")
.as("icon")
.should("have.attr", "accessible-name", "Open Picker");

cy.get("@input")
.realPress("F4");

cy.get("@datePicker")
.should("have.attr", "open");

cy.get("@icon")
.should("have.attr", "accessible-name", "Close Picker");

cy.get("@datePicker")
.shadow()
.find("ui5-calendar")
.realPress("Escape");

cy.get("@datePicker")
.should("not.have.attr", "open");

cy.get("@icon")
.should("have.attr", "accessible-name", "Open Picker");
});
});


Expand Down
5 changes: 5 additions & 0 deletions packages/main/src/DatePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import "@ui5/webcomponents-icons/dist/appointment-2.js";

import {
DATEPICKER_OPEN_ICON_TITLE,
DATEPICKER_OPEN_ICON_TITLE_OPENED,
DATEPICKER_DATE_DESCRIPTION,
DATETIME_COMPONENTS_PLACEHOLDER_PREFIX,
INPUT_SUGGESTIONS_TITLE,
Expand Down Expand Up @@ -920,6 +921,10 @@ class DatePicker extends DateComponentBase implements IFormInputElement {
}

get openIconTitle() {
if (this.open) {
return DatePicker.i18nBundle.getText(DATEPICKER_OPEN_ICON_TITLE_OPENED);
}

return DatePicker.i18nBundle.getText(DATEPICKER_OPEN_ICON_TITLE);
}

Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ COLORPICKER_ALPHA=Alpha
#XACT: DatePicker 'Open Picker' icon title
DATEPICKER_OPEN_ICON_TITLE=Open Picker

#XACT: DatePicker 'Open Picker' icon title when the picker is opened
DATEPICKER_OPEN_ICON_TITLE_OPENED=Close Picker

#XACT: Aria information for the Date Picker
DATEPICKER_DATE_DESCRIPTION=Date Input

Expand Down
Loading