Skip to content
Open
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
40 changes: 24 additions & 16 deletions packages/main/cypress/specs/Calendar.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1549,35 +1549,43 @@ describe("Calendar accessibility", () => {
});

describe("Day Picker Tests", () => {
it.skip("Select day with Space", () => {
it.only("Select day with Space", () => {
const today = new Date();
const tomorrow = Math.floor(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate() + 1, 0, 0, 0, 0) / 1000);

cy.mount(<Calendar id="calendar1"></Calendar>);

cy.get<Calendar>("#calendar1")
.shadow()
.find("[ui5-daypicker]")
.shadow()
.find(".ui5-dp-item--now")
.as("today");
.realClick();

cy.get("@today")
.realClick()
.should("be.focused")
.realPress("ArrowRight")
.realPress("Space");
cy.get<Calendar>("#calendar1")
.shadow()
.find("[ui5-daypicker]")
.shadow()
.find("[tabindex='0']")
.should("have.focus");

cy.focused()
.invoke("attr", "data-sap-timestamp")
.then(timestampAttr => {
const timestamp = parseInt(timestampAttr!);
const selectedDate = new Date(timestamp * 1000).getDate();
const expectedDate = new Date(Date.now() + 24 * 3600 * 1000).getDate();
expect(selectedDate).to.eq(expectedDate);
});
cy.get<Calendar>("#calendar1")
.realPress("ArrowRight");

cy.get<Calendar>("#calendar1")
.shadow()
.find("[ui5-daypicker]")
.shadow()
.find(`[data-sap-timestamp='${tomorrow}']`)
.should("have.focus");

cy.get<Calendar>("#calendar1")
.realPress("Space");

cy.get<Calendar>("#calendar1")
.should(($calendar) => {
const selectedDates = $calendar.prop("selectedDates");
expect(selectedDates).to.have.length.greaterThan(0);
expect(selectedDates).to.include(tomorrow);
});
});

Expand Down
Loading