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.

Studio frontend test: find the More flyout by its props in any order (#12356)

Daniel Hana61240aa9766
diff --git a/studio/frontend/tests/more-menu-separator-gap.test.ts b/studio/frontend/tests/more-menu-separator-gap.test.ts
index 41a22132531..f931812d694 100644
--- a/studio/frontend/tests/more-menu-separator-gap.test.ts
+++ b/studio/frontend/tests/more-menu-separator-gap.test.ts
@@ -20,13 +20,31 @@ function spacing(classes: string, prefix: string): number {
test("the More flyout's rule sits as far from its rows as the menu's own edge", async () => {
const source = await readSrcAsync("components/app-sidebar.tsx");
- const menu =
- /<DropdownMenuContent\s+side="right"\s+align="start"\s+sideOffset=\{6\}\s+className="([^"]*)"/.exec(
- source,
- );
+ // Found by its placement props in any order: #12339 put `ref={moreContentRef}` first
+ // and a regex pinned to `<DropdownMenuContent side="right"` stopped matching.
+ let menu: { className: string; end: number } | null = null;
+ for (const open of source.matchAll(/<DropdownMenuContent\b/g)) {
+ // The opening tag closes on its own line (`>` after the props); arrow functions inside it
+ // carry `=>`, so a bare `>` search would stop inside a handler.
+ const close = /\n\s*>\n/.exec(source.slice(open.index));
+ if (!close) continue;
+ const tag = source.slice(open.index, open.index + close.index + close[0].length);
+ const className = /\sclassName="([^"]*)"/.exec(tag);
+ if (
+ className &&
+ /\sside="right"/.test(tag) &&
+ /\salign="start"/.test(tag) &&
+ /\ssideOffset=\{6\}/.test(tag)
+ ) {
+ menu = { className: className[1], end: open.index + tag.length };
+ break;
+ }
+ }
assert.ok(menu, "could not find the More flyout's DropdownMenuContent");
- const rule = /<DropdownMenuSeparator className="(mx-1![^"]*)"/.exec(source);
+ // The rule inside that flyout, not the first styled separator anywhere in the file.
+ const flyout = source.slice(menu.end, source.indexOf("</DropdownMenuContent>", menu.end));
+ const rule = /<DropdownMenuSeparator className="(mx-1![^"]*)"/.exec(flyout);
assert.ok(rule, "could not find the More flyout's separator");
- assert.equal(spacing(rule[1], "my"), spacing(menu[1], "p"));
+ assert.equal(spacing(rule[1], "my"), spacing(menu.className, "p"));
});