UNPKG

@crossed/ui

Version:

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

25 lines (24 loc) 899 B
import { jsx } from "react/jsx-runtime"; import { Radio } from "../index"; import { screen, render, fireEvent } from "@crossed/test"; describe("Radio", () => { test("Simple render", () => { render(/* @__PURE__ */ jsx(Radio, { children: "Simple" })); const radio = screen.getByRole("radio"); expect(radio).toHaveAttribute("aria-checked", "false"); fireEvent.click(radio); expect(radio).toHaveAttribute("aria-checked", "true"); }); test("Disabled", () => { const onPress = jest.fn(); render( /* @__PURE__ */ jsx(Radio, { onPress, disabled: true, children: "Simple" }) ); const radio = screen.getByRole("radio"); expect(radio).toHaveAttribute("aria-checked", "false"); fireEvent.click(radio); expect(radio).toHaveAttribute("aria-checked", "false"); expect(onPress).not.toHaveBeenCalled(); }); }); //# sourceMappingURL=Radio.spec.js.map