Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(tooltip): add token theming tests #9463

Merged
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions packages/calcite-components/src/components/tooltip/tooltip.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { TOOLTIP_OPEN_DELAY_MS, TOOLTIP_CLOSE_DELAY_MS } from "../tooltip/resour
import { accessible, defaults, floatingUIOwner, hidden, openClose, renders } from "../../tests/commonTests";
import { html } from "../../../support/formatting";
import { getElementXY, GlobalTestProps } from "../../tests/utils";
import { ComponentTestTokens, themed } from "../../tests/commonTests/themed";
import { CSS } from "./resources";

interface PointerMoveOptions {
delay: number;
Expand Down Expand Up @@ -1078,4 +1080,45 @@ describe("calcite-tooltip", () => {
expect(await tooltip1.getProperty("open")).toBe(false);
expect(await tooltip2.getProperty("open")).toBe(true);
});

describe("theme", () => {
const tooltipHTML = html`
<calcite-tooltip placement="auto" reference-element="tooltip-auto-ref" open>
<p>placement: auto</p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua.
</calcite-tooltip>
<calcite-button appearance="outline" id="tooltip-auto-ref">auto</calcite-button>
`;

describe("default", () => {
const tokens: ComponentTestTokens = {
"--calcite-tooltip-background-color": {
shadowSelector: `.calcite-floating-ui-anim`,
anveshmekala marked this conversation as resolved.
Show resolved Hide resolved
targetProp: "backgroundColor",
},
"--calcite-tooltip-border-color": {
shadowSelector: `.calcite-floating-ui-anim`,
targetProp: "borderColor",
},
"--calcite-tooltip-corner-radius": {
shadowSelector: `.${CSS.container}`,
targetProp: "borderRadius",
},
"--calcite-tooltip-shadow": {
shadowSelector: `.calcite-floating-ui-anim`,
targetProp: "boxShadow",
},
"--calcite-tooltip-text-color": {
shadowSelector: `.${CSS.container}`,
targetProp: "color",
},
"--calcite-tooltip-z-index": {
selector: "calcite-tooltip",
targetProp: "zIndex",
},
};
themed(tooltipHTML, tokens);
});
});
});