diff --git a/ui/components/shadcn/collapsible.test.tsx b/ui/components/shadcn/collapsible.test.tsx index 827e2ce5dc..4615eedeac 100644 --- a/ui/components/shadcn/collapsible.test.tsx +++ b/ui/components/shadcn/collapsible.test.tsx @@ -24,16 +24,8 @@ describe("Collapsible", () => { expect(content).toHaveAttribute("data-slot", "collapsible-content"); expect(content).toHaveClass( "overflow-hidden", - "duration-200", - "ease-out", - "data-[state=open]:animate-in", - "data-[state=open]:fade-in-0", - "data-[state=open]:slide-in-from-top-1", - "data-[state=closed]:animate-out", - "data-[state=closed]:fade-out-0", - "data-[state=closed]:slide-out-to-top-1", - "data-[state=closed]:duration-150", - "data-[state=closed]:ease-in", + "data-[state=open]:animate-collapsible-down", + "data-[state=closed]:animate-collapsible-up", ); }); @@ -52,7 +44,6 @@ describe("Collapsible", () => { // Then expect(content).toHaveClass( "motion-reduce:animate-none", - "motion-reduce:transform-none", "motion-reduce:transition-none", ); }); diff --git a/ui/components/shadcn/collapsible.tsx b/ui/components/shadcn/collapsible.tsx index da4f1384ce..79ecefb75e 100644 --- a/ui/components/shadcn/collapsible.tsx +++ b/ui/components/shadcn/collapsible.tsx @@ -29,11 +29,10 @@ function CollapsibleContent({ diff --git a/ui/components/shadcn/tree-view/tree-view.test.tsx b/ui/components/shadcn/tree-view/tree-view.test.tsx index 4a4dbefd6a..5859133066 100644 --- a/ui/components/shadcn/tree-view/tree-view.test.tsx +++ b/ui/components/shadcn/tree-view/tree-view.test.tsx @@ -1,8 +1,32 @@ import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; +import { getTreeChildrenMotion } from "./tree-node"; import { TreeView } from "./tree-view"; +describe("getTreeChildrenMotion", () => { + it("animates height when motion is allowed", () => { + // Given / When + const motion = getTreeChildrenMotion(false); + + // Then + expect(motion.initial).toHaveProperty("height", 0); + expect(motion.animate).toHaveProperty("height", "auto"); + expect(motion.transition.duration).toBeGreaterThan(0); + }); + + it("degrades to opacity-only with no height under reduced motion", () => { + // Given / When + const motion = getTreeChildrenMotion(true); + + // Then + expect(motion.initial).not.toHaveProperty("height"); + expect(motion.animate).not.toHaveProperty("height"); + expect(motion.exit).not.toHaveProperty("height"); + expect(motion.transition.duration).toBe(0); + }); +}); + const treeData = [ { id: "org-1",