litellm/ui/litellm-dashboard/src/lib/cva.config.test.ts
ryan-crabbe-berri 6385b6d801 refactor(ui): replace hand-picked z-index values with one named scale and lint it
Regression LIT-6143 (the policy Flow Builder painting its guardrail dropdown
underneath a position: fixed shell at z-index 1000) was one instance of a
class of bug: pages picking their own z-index numbers above the portalled
popup layer. This removes the class.

- globals.css defines the only z-index values in the dashboard as Tailwind
  utilities: z-raised, z-chrome, z-sticky, z-sticky-pinned, z-floating,
  z-overlay, z-popup; every numeric, arbitrary and inline z-index across
  src is migrated onto them and tailwind-merge learns the tokens
- new local/no-ad-hoc-z-index ESLint rule bans z-<n>, z-[...], z-(...) and
  inline zIndex everywhere, and reserves z-popup for the portalled
  primitives in components/ui (and the DataTable menus)
- the Flow Builder renders in the dashboard content area instead of as a
  fixed full-screen overlay, so it has no stacking level at all
- the guardrail content-filter Add keyword / Add pattern / Custom pattern
  dialogs drop the leftover z-[1100] (renamed from ABOVE_ANTD_MODAL when
  antd was removed) that hid their own Action select and pattern combobox
  behind the dialog, the same bug as LIT-6143
2026-08-25 17:02:35 -07:00

21 lines
760 B
TypeScript

/* eslint-disable local/no-ad-hoc-z-index -- exercises how cn merges the banned numeric classes against the tokens */
import { describe, expect, it } from "vitest";
import { cn } from "./cva.config";
describe("cn z-index token merging", () => {
it("keeps only the last z token when two tokens conflict", () => {
expect(cn("z-raised", "z-overlay")).toBe("z-overlay");
});
it("lets a z token override a numeric z class", () => {
expect(cn("z-50", "z-popup")).toBe("z-popup");
});
it("lets a numeric z class override a z token", () => {
expect(cn("z-popup", "z-50")).toBe("z-50");
});
it("does not merge z tokens with unrelated classes", () => {
expect(cn("z-chrome", "sticky", "top-0")).toBe("z-chrome sticky top-0");
});
});