adding monkeytype
Some checks failed
Mark Stale PRs / stale (push) Has been cancelled

This commit is contained in:
Benjamin Falch
2026-04-23 13:53:44 +02:00
parent e214a2fd35
commit 2bc741fb78
1930 changed files with 7590652 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
import { render, screen } from "@solidjs/testing-library";
import { describe, it, expect } from "vitest";
import { LabeledField } from "../../../../src/ts/components/ui/form/LabeledField";
describe("LabeledField", () => {
it("renders label text correctly", () => {
render(() => (
<LabeledField label="test label">
<input />
</LabeledField>
));
expect(screen.getByText("test label")).toBeInTheDocument();
});
it("renders children correctly", () => {
render(() => (
<LabeledField label="test">
<div data-testid="child">child content</div>
</LabeledField>
));
expect(screen.getByTestId("child")).toBeInTheDocument();
});
it("renders subtext when provided", () => {
render(() => (
<LabeledField label="test" subLabel="helper text">
<input />
</LabeledField>
));
expect(screen.getByText("helper text")).toBeInTheDocument();
});
it("links label to input when id is provided", () => {
const { container } = render(() => (
<LabeledField label="test" id="test-id">
<input id="test-id" />
</LabeledField>
));
const label = container.querySelector("label");
expect(label).toHaveAttribute("for", "test-id");
});
it("applies custom class to wrapper", () => {
const { container } = render(() => (
<LabeledField label="test" class="custom-wrapper-class">
<input />
</LabeledField>
));
expect(container.firstChild).toHaveClass("custom-wrapper-class");
});
});