mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
The invite-dialog test only read data-orientation, so a regression inside the shared field variants could restore the full-width bar and still pass. Assert the classes that carry the layout, cover the two SSO call sites the fix also changed, and pin the vertical/horizontal contract on the primitive.
18 lines
817 B
TypeScript
18 lines
817 B
TypeScript
import { expect } from "vitest";
|
|
|
|
export const ROW_LAYOUT_CLASSES = ["flex-row", "items-center"] as const;
|
|
export const STRETCH_CHILDREN_CLASS = "*:w-full";
|
|
|
|
/**
|
|
* Asserts a control sits beside its label at its own width instead of being stretched across the
|
|
* field. Reaches for the resolved classes because the defect is purely visual: nothing accessible
|
|
* distinguishes a square checkbox from a full-width bar.
|
|
*/
|
|
export const expectControlBesideLabel = (control: HTMLElement): void => {
|
|
const field = control.closest('[data-slot="field"]');
|
|
if (field === null) throw new Error("control is not rendered inside a form field");
|
|
|
|
expect(field).toHaveAttribute("data-orientation", "horizontal");
|
|
expect(field).toHaveClass(...ROW_LAYOUT_CLASSES);
|
|
expect(field).not.toHaveClass(STRETCH_CHILDREN_CLASS);
|
|
};
|