/** @jsxImportSource test */
import {
ActivityIndicator,
ImageBackground,
KeyboardAvoidingView,
Modal,
Pressable,
ScrollView,
StatusBar,
Text,
TextInput,
View,
VirtualizedList,
} from "react-native";
import { registerCSS, render, screen, setupAllComponents } from "test";
const testID = "react-native-css-interop";
setupAllComponents();
test("Component types", () => {
[
,
,
,
,
,
,
,
,
,
null}
className="bg-black"
ListHeaderComponentClassName="bg-black"
ListFooterComponentClassName="bg-black"
contentContainerClassName="bg-black"
indicatorClassName="bg-black"
/>,
];
});
test("TextInput", () => {
registerCSS(
`.text-black { color: black }
.placeholder\\:text-white {
@rn-move color placeholderTextColor;
color: #fff
}`,
);
render(
,
);
const component = screen.getByTestId(testID);
expect(component.props).toEqual(
expect.objectContaining({
testID,
placeholderTextColor: "#ffffff",
style: {
color: "#000000",
},
}),
);
});
test("ActivityIndicator", () => {
registerCSS(
`.bg-black { background-color: black } .text-white { color: white }`,
);
render();
const component = screen.getByTestId(testID);
// These should be removed
expect(component.props).not.toEqual({
className: expect.any,
});
// ActivityIndicator will not render a backgroundColor
expect(component.props).toEqual(
expect.objectContaining({
testID,
color: "#ffffff",
style: {
backgroundColor: "#000000",
},
}),
);
});
test(`ScrollView`, () => {
registerCSS(`
.bg-black { background-color: black }
.gap-10 { gap: 10 }
.pt-20 {
padding-top: 5rem
}
`);
render(
,
);
const component = screen.getByTestId(testID);
expect(component.props).toStrictEqual({
testID,
children: expect.any(Array),
contentContainerStyle: {
columnGap: 10,
rowGap: 10,
paddingTop: 70,
},
style: {
backgroundColor: "#000000",
},
});
});