Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions packages/main/cypress/specs/ColorPalette.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ describe("Color Palette tests", () => {
cy.mount(<ColorPaletteSample/>);

cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 0, "ArrowRight", "pink");
cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 0, "ArrowLeft", "orange");
cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 0, "ArrowUp", "orange");
cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 9, "ArrowDown", "darkblue");
cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 0, "ArrowLeft", "darkblue");
cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 0, "ArrowUp", "darkblue");
cy.ui5ColorPaletteNavigateAndCheckSelectedColor("#cp1", 9, "ArrowDown", "orange");
});

it("Tests show-recent-colors functionality", () => {
Expand Down
68 changes: 43 additions & 25 deletions packages/main/cypress/specs/ColorPalettePopover.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe("Color Popover Palette events tests", () => {
});

describe("Color Popover Palette arrow keys navigation", () => {
it("should navigate with Arrow right", () => {
it("should navigate with Arrow Down from last swatch to More Colors", () => {
cy.mount(
<SimplePalettePopover showMoreColors={true} />
);
Expand All @@ -322,13 +322,13 @@ describe("Color Popover Palette arrow keys navigation", () => {
.and("include", "red");

cy.focused()
.realPress("ArrowRight");
.realPress("ArrowDown");

cy.focused()
.should("have.attr", "aria-label", "More Colors...");

cy.focused()
.realPress("ArrowLeft");
.realPress("ArrowUp");

cy.focused()
.should("have.attr", "aria-label")
Expand Down Expand Up @@ -366,7 +366,7 @@ describe("Color Popover Palette arrow keys navigation", () => {
.should("have.attr", "_selected-color", "hotpink");
});

it("should navigate with Arrow left", () => {
it("should navigate with Arrow Down and Arrow Up between Default Color and swatches", () => {
cy.mount(
<SimplePalettePopover showDefaultColor={true} />
);
Expand All @@ -389,19 +389,16 @@ describe("Color Popover Palette arrow keys navigation", () => {
cy.get("@defaultColorButton")
.should("have.focus");

// Navigate right to first color item
// Navigate down to first color item
cy.get("@defaultColorButton")
.realPress("ArrowRight");
.realPress("ArrowDown");

cy.get("[ui5-color-palette-popover]")
.ui5GetColorPaletteItem(0)
.as("firstColorItem")
.should("be.visible")
.and("have.attr", "value", "cyan");

cy.get("@firstColorItem")
.should("have.attr", "value", "cyan");

cy.get("@firstColorItem")
.should("have.focus")
.shadow()
Expand All @@ -411,7 +408,7 @@ describe("Color Popover Palette arrow keys navigation", () => {
.and("include", "cyan");

cy.focused()
.realPress("ArrowLeft");
.realPress("ArrowUp");

cy.focused()
.should("have.attr", "aria-label", "Default Color");
Expand All @@ -420,7 +417,7 @@ describe("Color Popover Palette arrow keys navigation", () => {
.should("have.focus");
});

it("should cycle through colors horizontally with left/right arrows", () => {
it("should stay at boundary when navigating horizontally past edges", () => {
cy.mount(
<SimplePalettePopover />
);
Expand Down Expand Up @@ -450,20 +447,33 @@ describe("Color Popover Palette arrow keys navigation", () => {
.should("have.attr", "aria-label")
.and("include", "red");

// At last item, ArrowRight stays (no sections to escape to)
cy.focused()
.realPress("ArrowRight");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "red");

// Navigate back to first
cy.focused()
.realPress("ArrowLeft");
cy.focused()
.realPress("ArrowLeft");
cy.focused()
.realPress("ArrowLeft");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "cyan");

// At first item, ArrowLeft stays (no sections to escape to)
cy.focused()
.realPress("ArrowLeft");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "red");
.and("include", "cyan");
});

it("should cycle through colors vertically with up/down arrows", () => {
it("should navigate vertically with up/down arrows", () => {
cy.mount(
<MultiRowPalettePopover />
);
Expand All @@ -481,17 +491,11 @@ describe("Color Popover Palette arrow keys navigation", () => {
.should("have.attr", "aria-label")
.and("include", "yellow");

cy.focused()
.realPress("ArrowDown");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "orange");

cy.focused()
.realPress("ArrowUp");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "yellow");
.and("include", "cyan");
});

it("should navigate to More Colors from colors grid", () => {
Expand All @@ -502,19 +506,24 @@ describe("Color Popover Palette arrow keys navigation", () => {
cy.get("[ui5-color-palette-popover]")
.ui5ColorPalettePopoverOpen({ opener: "btnPalette" });

// Navigate to last item in second (incomplete) row
cy.focused()
.realPress("End");
cy.focused()
.realPress("End");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "green");
.and("include", "purple");

// ArrowDown from last row goes to More Colors
cy.focused()
.realPress("ArrowDown");
cy.focused()
.should("have.attr", "aria-label", "More Colors...");

// ArrowUp from More Colors restores column back into grid
cy.focused()
.realPress("ArrowLeft");
.realPress("ArrowUp");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "purple");
Expand All @@ -528,17 +537,26 @@ describe("Color Popover Palette arrow keys navigation", () => {
cy.get("[ui5-color-palette-popover]")
.ui5ColorPalettePopoverOpen({ opener: "btnPalette" });

// Navigate to second row item
cy.focused()
.realPress("End");
.realPress("ArrowDown");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "green");
.and("include", "yellow");

// Navigate right within incomplete row
cy.focused()
.realPress("ArrowRight");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "purple");

// ArrowUp from column 1 in last row goes to column 1 in first row
cy.focused()
.realPress("ArrowUp");
cy.focused()
.should("have.attr", "aria-label")
.and("include", "red");
.and("include", "orange");
});
});

Expand Down
Loading
Loading