Skip to content

Commit

Permalink
test(shell): add token theming tests (#9458)
Browse files Browse the repository at this point in the history
**Related Issue:**#7180

## Summary
Add token theming tests for `shell`.
  • Loading branch information
Elijbet authored Jun 19, 2024
1 parent 2192a33 commit f2e3346
Showing 1 changed file with 66 additions and 1 deletion.
67 changes: 66 additions & 1 deletion packages/calcite-components/src/components/shell/shell.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { newE2EPage } from "@stencil/core/testing";
import { accessible, hidden, renders, slots } from "../../tests/commonTests";
import { accessible, hidden, renders, slots, themed } from "../../tests/commonTests";
import { html } from "../../../support/formatting";
import { ComponentTestTokens } from "../../tests/commonTests/themed";
import { CSS, SLOTS } from "./resources";

describe("calcite-shell", () => {
Expand Down Expand Up @@ -122,3 +123,67 @@ describe("calcite-shell", () => {
expect(panelTop).toBeNull();
});
});

describe("theme", () => {
const shellHTML = html`
<calcite-shell>
<calcite-tip-manager>
<calcite-tip heading="Example tip title">
<calcite-link href="http://www.esri.com">An example link</calcite-link>
</calcite-tip>
</calcite-tip-manager>
<calcite-panel heading="Leading panel content"></calcite-panel>
<calcite-flow heading="Leading panel content"></calcite-flow>
<calcite-shell-center-row slot="${SLOTS.panelBottom}"></calcite-shell-center-row>
<calcite-shell-center-row slot="${SLOTS.panelTop}"></calcite-shell-center-row>
<calcite-shell-center-row slot="${SLOTS.centerRow}"></calcite-shell-center-row>
</calcite-shell>
`;

describe("slotted overrides", () => {
const tokens: ComponentTestTokens = {
"--calcite-shell-border-color": [
{
selector: `calcite-panel`,
targetProp: "borderColor",
},
{
selector: `calcite-flow`,
targetProp: "borderColor",
},
{
selector: `calcite-shell-center-row[slot="${SLOTS.panelBottom}"]`,
targetProp: "borderColor",
},
{
selector: `calcite-shell-center-row[slot="${SLOTS.panelTop}"]`,
targetProp: "borderColor",
},
{
selector: `calcite-shell-center-row[slot="${SLOTS.centerRow}"]`,
targetProp: "borderColor",
},
],
};
themed(async () => shellHTML, tokens);
});

describe("default", () => {
const tokens: ComponentTestTokens = {
"--calcite-shell-background-color": {
targetProp: "backgroundColor",
},
};
themed(async () => shellHTML, tokens);
});

describe("deprecated", () => {
const tokens: ComponentTestTokens = {
"--calcite-shell-tip-spacing": {
selector: `calcite-tip-manager`,
targetProp: "insetInline",
},
};
themed(async () => shellHTML, tokens);
});
});

0 comments on commit f2e3346

Please sign in to comment.