-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Ask your Question
I currently have a React Native project which uses Tailwind/NativeWind for applying different widths depending on the screen size.
const MyComponent = () => (
<View className="w-16 lg:m-32" testID="testID">
<Text title="Hello world" />
</View>
);In my current unit test, I've got something along the lines of...
it("should have a width of 64px", () => {
const { getByTestId } = render(<MyComponent />);
const foundBodyElement = getByTestId("testID");
expect((foundBodyElement.props as ElementProps).style).toEqual(expect.arrayContaining([
expect.objectContaining({
width: 64,
})
]));
});I'd like to also have a test for the the large screens to assert they have a larger width... something along the lines of:
it("should have a width of 128px", () => {
const { getByTestId } = render(<MyComponent />);
const foundBodyElement = getByTestId("testID");
expect((foundBodyElement.props as ElementProps).style).toEqual(expect.arrayContaining([
expect.objectContaining({
width: 128,
})
]));
});However, I'm not sure how I can get the second test to think it's on a larger screen so that the larger class name gets applied.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested