UNPKG

@crossed/ui

Version:

A universal & performant styling library for React Native, Next.js & React

43 lines (42 loc) 1.52 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { render, screen } from "@crossed/test"; import { Calendar } from "../Calendar"; jest.mock("../SelectMonth", () => ({ SelectMonth: ({ month, onChange }) => /* @__PURE__ */ jsxs( "select", { "data-testid": "select-month", value: month, onChange: (e) => onChange(Number(e.target.value)), children: [ /* @__PURE__ */ jsx("option", { value: "0", children: "January" }), /* @__PURE__ */ jsx("option", { value: "1", children: "February" }), /* @__PURE__ */ jsx("option", { value: "2", children: "March" }) ] } ) })); jest.mock("../SelectYear", () => ({ SelectYear: ({ year, onChange, years }) => /* @__PURE__ */ jsx( "select", { "data-testid": "select-year", value: year, onChange: (e) => onChange(Number(e.target.value)), children: years.map((y) => /* @__PURE__ */ jsx("option", { value: y, children: y }, y)) } ) })); describe("Calendar", () => { const mockDate = new Date(2025, 1, 15); test("renders correctly with default props", () => { render(/* @__PURE__ */ jsx(Calendar, { selectedDate: mockDate })); expect(screen.getByText("February")).toBeInTheDocument(); expect(screen.getByText("2025")).toBeInTheDocument(); }); test("renders days correctly", () => { render(/* @__PURE__ */ jsx(Calendar, { selectedDate: mockDate })); expect(screen.getByText("15")).toBeInTheDocument(); }); }); //# sourceMappingURL=Calendar.spec.js.map