Skip to content

Commit df6bf86

Browse files
authored
test(stepper): add token theming tests (#9484)
**Related Issue:** #7180 ## Summary Add token theming tests for `stepper`.
1 parent f42fdf7 commit df6bf86

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

packages/calcite-components/src/components/stepper/resources.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ export const CSS = {
33
actionIconStart: "action-icon--start",
44
actionIconEnd: "action-icon--end",
55
actionContainer: "action-container",
6+
rect: "rect",
7+
stepBar: "step-bar",
8+
stepBarComplete: "step-bar--complete",
9+
stepBarError: "step-bar--error",
10+
stepBarSelected: "step-bar--selected",
611
stepBarContainer: "step-bar-container",
712
singleView: "single-view",
813
};

packages/calcite-components/src/components/stepper/stepper.e2e.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { E2EPage, newE2EPage } from "@stencil/core/testing";
2-
import { defaults, hidden, reflects, renders, t9n } from "../../tests/commonTests";
2+
import { defaults, hidden, reflects, renders, t9n, themed } from "../../tests/commonTests";
33
import { html } from "../../../support/formatting";
44
import { NumberStringFormatOptions } from "../../utils/locale";
55
import { isElementFocused } from "../../tests/utils";
6+
import { ComponentTestTokens } from "../../tests/commonTests/themed";
7+
import { CSS } from "./resources";
68

79
// we use browser-context function to click on items to workaround `E2EElement#click` error
810
async function itemClicker(item: HTMLCalciteStepperItemElement) {
@@ -899,4 +901,74 @@ describe("calcite-stepper", () => {
899901
expect(displayedItems.length).toBe(1);
900902
});
901903
});
904+
905+
describe("theme", () => {
906+
describe("default", () => {
907+
const tokens: ComponentTestTokens = {
908+
"--calcite-stepper-action-background-color": {
909+
shadowSelector: `calcite-action`,
910+
targetProp: "--calcite-action-background-color",
911+
},
912+
"--calcite-stepper-action-background-color-hover": {
913+
shadowSelector: `calcite-action`,
914+
targetProp: "--calcite-action-background-color",
915+
state: { hover: { attribute: "class", value: CSS.actionIcon } },
916+
},
917+
"--calcite-stepper-action-background-color-active": {
918+
shadowSelector: `calcite-action`,
919+
targetProp: "--calcite-action-background-color",
920+
state: { press: { attribute: "class", value: CSS.actionIcon } },
921+
},
922+
"--calcite-stepper-step-bar-fill-color": {
923+
shadowSelector: `.${CSS.stepBar} ${CSS.rect}`,
924+
targetProp: "fill",
925+
},
926+
"--calcite-stepper-step-bar-fill-color-hover": {
927+
shadowSelector: `.${CSS.stepBar} ${CSS.rect}`,
928+
targetProp: "fill",
929+
state: "hover",
930+
},
931+
"--calcite-stepper-step-bar-selected-fill-color": {
932+
shadowSelector: `.${CSS.stepBarSelected}`,
933+
targetProp: "fill",
934+
},
935+
"--calcite-stepper-step-bar-complete-fill-color": {
936+
shadowSelector: `.${CSS.stepBarComplete}`,
937+
targetProp: "fill",
938+
},
939+
"--calcite-stepper-step-bar-completed-fill-color-hover": {
940+
shadowSelector: `.${CSS.stepBarComplete}`,
941+
targetProp: "fill",
942+
state: "hover",
943+
},
944+
"--calcite-stepper-step-bar-error-fill-color": {
945+
shadowSelector: `.${CSS.stepBarError}`,
946+
targetProp: "fill",
947+
},
948+
"--calcite-stepper-step-bar-error-fill-color-hover": {
949+
shadowSelector: `.${CSS.stepBarError}`,
950+
targetProp: "fill",
951+
},
952+
};
953+
themed(
954+
html`
955+
<calcite-stepper layout="horizontal-single" numbered icon scale="s">
956+
<calcite-stepper-item heading="Confirm and complete">
957+
<div>Step 4 Content Goes Here</div>
958+
</calcite-stepper-item>
959+
<calcite-stepper-item heading="Choose method" selected>
960+
<div>Step 1 Content Goes Here</div>
961+
</calcite-stepper-item>
962+
<calcite-stepper-item heading="Compile member list" complete>
963+
<div>Step 2 Content Goes Here</div>
964+
</calcite-stepper-item>
965+
<calcite-stepper-item heading="Set member properties" description="Some subtext" error>
966+
<div>Step 3 Content Goes Here</div>
967+
</calcite-stepper-item>
968+
</calcite-stepper>
969+
`,
970+
tokens,
971+
);
972+
});
973+
});
902974
});

0 commit comments

Comments
 (0)