Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Frontend tests: read the composer shadow and palette seeds where #12800 left them (#12810)

Daniel Han6e2fc5190381
diff --git a/studio/frontend/tests/color-themes.test.ts b/studio/frontend/tests/color-themes.test.ts
index bb1a75b3341..d0a696586d5 100644
--- a/studio/frontend/tests/color-themes.test.ts
+++ b/studio/frontend/tests/color-themes.test.ts
@@ -99,9 +99,14 @@ test("flavor accents used as text meet the accent-text floor", () => {
["light", `:root[data-palette="${id}"]:not(.dark) {`],
["dark", `:root[data-palette="${id}"].dark {`],
] as const) {
- const start = indexCss.indexOf(selector);
- assert.ok(start >= 0, `${id} ${mode} block`);
- const block = indexCss.slice(start, indexCss.indexOf("}", start));
+ // A palette can open the same selector more than once (its seeds in one block, a shared
+ // variable such as --composer-shadow in another), so read every block it opens.
+ const blocks: string[] = [];
+ for (let start = indexCss.indexOf(selector); start >= 0; start = indexCss.indexOf(selector, start + 1)) {
+ blocks.push(indexCss.slice(start, indexCss.indexOf("}", start)));
+ }
+ assert.ok(blocks.length > 0, `${id} ${mode} block`);
+ const block = blocks.join("\n");
const token = (name: string) =>
block.match(new RegExp(`\\s${name}: (#[0-9a-f]{6});`))?.[1];
const page = token("--th-bg");
diff --git a/studio/frontend/tests/find-in-page.test.ts b/studio/frontend/tests/find-in-page.test.ts
index 70796504fd0..579ae62c5e4 100644
--- a/studio/frontend/tests/find-in-page.test.ts
+++ b/studio/frontend/tests/find-in-page.test.ts
@@ -1423,8 +1423,17 @@ test("light mode is the chatbox's background, under a slightly heavier shadow",
alpha: Number(hit[4]),
};
};
- const from = shape(composer);
- const to = shape(bar);
+ // The composer may read its shadow from a variable (it shares one with the toasts); compare the
+ // light value that variable holds, which is what the composer paints in light mode.
+ const resolved = (rule: string) => {
+ const ref = /box-shadow:\s*var\((--[\w-]+)\);/.exec(rule);
+ if (!ref) return rule;
+ const value = new RegExp(`\\s${ref[1]}:\\s*([^;]+);`).exec(cssRule(INDEX, ":root"));
+ assert.ok(value, `${ref[1]} has no light value in :root`);
+ return `box-shadow: ${value[1]};`;
+ };
+ const from = shape(resolved(composer));
+ const to = shape(resolved(bar));
assert.ok(
to.blur > from.blur,
`blur ${to.blur} is not wider than ${from.blur}`,