Skip to content

Commit

Permalink
test(button-toggle): bring back and amend cypress test for rounded
Browse files Browse the repository at this point in the history
  • Loading branch information
DobroTora committed Oct 16, 2023
1 parent 78c10a1 commit 22d6110
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
34 changes: 34 additions & 0 deletions cypress/components/button-toggle/button-toggle.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,40 @@ context("Testing Button-Toggle component", () => {
});
});

describe("rounded corners", () => {
it("has the expected border-radius styling on a single toggle button", () => {
CypressMountWithProviders(
<ButtonToggleComponent>Foo</ButtonToggleComponent>
);

buttonToggleButton().each((el) =>
expect(el.css("border-radius")).equals("4px")
);
});

it("should have the expected border-radius styling when the children have the grouped prop set", () => {
CypressMountWithProviders(
<stories.ButtonToggleGroupComponentGroupedChildren />
);

buttonToggleButton()
.eq(0)
.should("have.css", "border-radius", "4px 0px 0px 4px");
buttonToggleButton().eq(1).should("have.css", "border-radius", "0px");
buttonToggleButton()
.eq(2)
.should("have.css", "border-radius", "0px 4px 4px 0px");
});

it("should have the expected border-radius styling when children do not have grouped prop set", () => {
CypressMountWithProviders(<stories.ButtonToggleGroupComponent />);

buttonToggleButton().eq(0).should("have.css", "border-radius", "4px");
buttonToggleButton().eq(1).should("have.css", "border-radius", "4px");
buttonToggleButton().eq(2).should("have.css", "border-radius", "4px");
});
});

it("should render Button-Toggle with aria-label prop", () => {
CypressMountWithProviders(
<ButtonToggleComponent aria-label="cypress-aria" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ exports[`ButtonToggle General styling renders correctly when grouped 1`] = `
border: 1px solid var(--colorsActionMinor500);
color: var(--colorsActionMinor500);
border: 1px solid var(--colorsActionMinor500);
color: var(--colorsActionMinor500);
border: 1px solid var(--colorsActionMinor500);
}
.c2:focus {
Expand Down Expand Up @@ -58,11 +60,11 @@ exports[`ButtonToggle General styling renders correctly when grouped 1`] = `
color: var(--colorsActionMinor500);
}
.c2 .c4 {
s .c2 .c4 {
color: var(--colorsActionMinor500);
}
.c2 .c4:not([aria-pressed="true"]):not(:disabled):hover {
s .c2 .c4:not([aria-pressed="true"]):not(:disabled):hover {
color: var(--colorsActionMinorYang100);
}
Expand Down Expand Up @@ -93,6 +95,32 @@ exports[`ButtonToggle General styling renders correctly when grouped 1`] = `
box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500), 0px 0px 0px var(--borderWidth300) var(--colorsSemanticFocus500), 0px 0px 0px var(--borderWidth600) var(--colorsUtilityYin090);
}
.c2 .c4 {
color: var(--colorsActionMinor500);
}
.c2 .c4:not([aria-pressed="true"]):not(:disabled):hover {
color: var(--colorsActionMinorYang100);
}
.c2:not([aria-pressed="true"]):not(:disabled):hover {
color: var(--colorsActionMinorYang100);
background-color: var(--colorsActionMinor600);
}
.c2:not([aria-pressed="true"]):not(:disabled):hover .c4 {
color: var(--colorsActionMinorYang100);
}
.c2:not(:disabled):hover {
background-color: var(--colorsActionMinor600);
color: var(--colorsActionMinorYang100);
}
.c2:not(:disabled):hover .c4 {
color: var(--colorsActionMinorYang100);
}
.c3.c3.c3.c3 .c1 {
border-radius: var(--borderRadius050);
}
Expand Down

0 comments on commit 22d6110

Please sign in to comment.