From 24a1e994d4b6a2ea174ff6d62cf5ea6890077d8f Mon Sep 17 00:00:00 2001 From: JC Franco Date: Sat, 11 Jan 2025 01:35:55 -0800 Subject: [PATCH] test: preload all icons for chromatic screenshot tests --- packages/calcite-components/src/components/icon/icon.tsx | 2 +- packages/calcite-components/vite.config.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/calcite-components/src/components/icon/icon.tsx b/packages/calcite-components/src/components/icon/icon.tsx index e42308a1005..46835ef6dfd 100644 --- a/packages/calcite-components/src/components/icon/icon.tsx +++ b/packages/calcite-components/src/components/icon/icon.tsx @@ -77,7 +77,7 @@ export class Icon extends LitElement { // #region Lifecycle override connectedCallback(): void { - if (this.preload) { + if (this.preload || (import.meta.env.DEV && __STORYBOOK_SCREENSHOT_TEST_BUILD__)) { this.visible = true; this.loadIconPathData(); return; diff --git a/packages/calcite-components/vite.config.ts b/packages/calcite-components/vite.config.ts index 8b08cc4e896..c665274a3b7 100644 --- a/packages/calcite-components/vite.config.ts +++ b/packages/calcite-components/vite.config.ts @@ -89,6 +89,7 @@ export default defineConfig({ __CALCITE_BUILD_DATE__: JSON.stringify(new Date().toISOString().split("T")[0]), __CALCITE_REVISION__: JSON.stringify(execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim()), __CALCITE_VERSION__: JSON.stringify(version), + __STORYBOOK_SCREENSHOT_TEST_BUILD__: process.env.STORYBOOK_SCREENSHOT_TEST_BUILD, }, test: {