/** @jsxImportSource nativewind */ import { StyleSheet, 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 background = () => StyleSheet.flatten(screen.getByTestId(testID).props.style)?.backgroundColor; expect(background()).toBeUndefined(); rerender(); expect(background()).toBe("#000000"); rerender( , ); expect(background()).toBeUndefined(); });