From 87889830dcb4bcb83d2d857982c4fbf3f691fb22 Mon Sep 17 00:00:00 2001 From: Adam Tirella Date: Fri, 17 May 2024 11:17:52 -0700 Subject: [PATCH] test(meter): Add token theming tests (#9357) **Related Issue:** #7180 ## Summary Add token theming tests for Meter --- .../src/components/meter/meter.e2e.ts | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/packages/calcite-components/src/components/meter/meter.e2e.ts b/packages/calcite-components/src/components/meter/meter.e2e.ts index f7d06e495eb..0b05ba17561 100644 --- a/packages/calcite-components/src/components/meter/meter.e2e.ts +++ b/packages/calcite-components/src/components/meter/meter.e2e.ts @@ -1,6 +1,8 @@ import { newE2EPage } from "@stencil/core/testing"; import { html } from "../../../support/formatting"; -import { accessible, renders, hidden, defaults, reflects } from "../../tests/commonTests"; +import { accessible, renders, hidden, defaults, reflects, themed } from "../../tests/commonTests"; +import { ComponentTestTokens } from "../../tests/commonTests/themed"; +import { CSS } from "./resources"; describe("calcite-meter", () => { describe("renders", () => { @@ -97,6 +99,61 @@ describe("calcite-meter", () => { accessible(``); }); + describe("theme", () => { + const meterHtml = html``; + + describe("default", () => { + const tokens: ComponentTestTokens = { + "--calcite-meter-background-color": { + shadowSelector: `.${CSS.container}`, + targetProp: "backgroundColor", + }, + "--calcite-meter-border-color": { + shadowSelector: `.${CSS.container}`, + targetProp: "borderColor", + }, + "--calcite-meter-corner-radius": [ + { + shadowSelector: `.${CSS.container}`, + targetProp: "borderRadius", + }, + { + shadowSelector: `.${CSS.fill}`, + targetProp: "borderRadius", + }, + ], + "--calcite-meter-shadow": { + targetProp: "boxShadow", + shadowSelector: `.${CSS.container}`, + }, + "--calcite-meter-fill-color": { + shadowSelector: `.${CSS.fill}`, + targetProp: "backgroundColor", + }, + "--calcite-meter-range-text-color": { + shadowSelector: `.${CSS.labelRange}`, + targetProp: "color", + }, + "--calcite-meter-value-text-color": { + shadowSelector: `.${CSS.labelValue}`, + targetProp: "color", + }, + }; + themed(meterHtml, tokens); + }); + }); + describe("correctly sets range and value properties", () => { it("correctly sets range and value properties if not present", async () => { const page = await newE2EPage({