Download src/components/features/diff-viewer/editor-container.test.tsx from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/components/features/diff-viewer/editor-container.test.tsx
- Command line
-
hf download hf://SaylorTwift/openhands/src/components/features/diff-viewer/editor-container.test.tsx
-
curl -L -o editor-container.test.tsx https://huggingface.co/SaylorTwift/openhands/resolve/main/src/components/features/diff-viewer/editor-container.test.tsx
1.16 kB
| import { render, screen } from "@testing-library/react"; | |
| import { describe, it, expect } from "vitest"; | |
| import { EditorContainer } from "./editor-container"; | |
| describe("EditorContainer", () => { | |
| it("renders children", () => { | |
| render( | |
| <EditorContainer height={400}> | |
| <div data-testid="child" /> | |
| </EditorContainer>, | |
| ); | |
| expect(screen.getByTestId("child")).toBeInTheDocument(); | |
| }); | |
| it("renders with the editor-container test id", () => { | |
| render( | |
| <EditorContainer height={300}> | |
| <div data-testid="inner" /> | |
| </EditorContainer>, | |
| ); | |
| expect(screen.getByTestId("editor-container")).toBeInTheDocument(); | |
| }); | |
| // Functional contract: the `height` prop is observable only via the | |
| // `--editor-height` CSS custom property the component writes to the DOM. | |
| it("sets the --editor-height CSS variable based on height prop", () => { | |
| render( | |
| <EditorContainer height={500}> | |
| <div data-testid="inner" /> | |
| </EditorContainer>, | |
| ); | |
| const container = screen.getByTestId("editor-container"); | |
| expect(container.style.getPropertyValue("--editor-height")).toBe("500px"); | |
| }); | |
| }); | |