/** @jsxImportSource nativewind */ import { Switch, TextInput, View } from "react-native"; import { fireEvent, render, screen } from "../test"; const testID = "component"; test("hover", async () => { await render(); const component = screen.getByTestId(testID); expect(component).toHaveStyle(undefined); fireEvent(component, "hoverIn"); expect(component).toHaveStyle({ color: "#ffffff" }); fireEvent(component, "hoverOut"); expect(component).toHaveStyle(undefined); }); test("focus", async () => { await render(); const component = screen.getByTestId(testID); expect(component).toHaveStyle(undefined); fireEvent(component, "focus"); expect(component).toHaveStyle({ color: "#ffffff" }); fireEvent(component, "blur"); expect(component).toHaveStyle(undefined); }); test("active", async () => { await render(); const component = screen.getByTestId(testID); expect(component).toHaveStyle(undefined); fireEvent(component, "pressIn"); expect(component).toHaveStyle({ color: "#ffffff" }); fireEvent(component, "pressOut"); expect(component).toHaveStyle(undefined); }); test("mixed", async () => { await render( , ); const component = screen.getByTestId(testID); expect(component).toHaveStyle(undefined); fireEvent(component, "pressIn"); expect(component).toHaveStyle(undefined); fireEvent(component, "hoverIn"); expect(component).toHaveStyle(undefined); fireEvent(component, "focus"); expect(component).toHaveStyle({ color: "#ffffff" }); }); test("selection", async () => { await render(); const component = screen.getByTestId(testID); expect(component.props).toEqual({ testID, selectionColor: "#000000", }); }); test("ltr:", async () => { await render(); const component = screen.getByTestId(testID); expect(component).toHaveStyle({ color: "#000000", }); }); test("placeholder", async () => { await render( , ); const component = screen.getByTestId(testID); expect(component.props).toEqual({ testID, placeholderTextColor: "#000000", }); }); test("disabled", async () => { const { rerender } = await render( , ); const component = screen.getByTestId(testID); expect(component.props).toEqual( expect.objectContaining({ testID, style: { height: 31, width: 51, }, }), ); rerender(); expect(component.props).toEqual( expect.objectContaining({ testID, style: [ { height: 31, width: 51, }, { backgroundColor: "#000000", }, ], }), ); rerender( , ); expect(component.props).toEqual( expect.objectContaining({ testID, style: { height: 31, width: 51, }, }), ); });