Skip to content

Commit fa3b964

Browse files
committed
refactor: code review changes
1 parent 0258194 commit fa3b964

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/__tests__/react-native-api.test.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ test('React Native API assumption: <TextInput> renders single host element', ()
7272
placeholder="Placeholder"
7373
/>
7474
);
75+
7576
expect(view.toJSON()).toMatchInlineSnapshot(`
7677
<TextInput
7778
defaultValue="default"
@@ -82,11 +83,29 @@ test('React Native API assumption: <TextInput> renders single host element', ()
8283
`);
8384
});
8485

86+
test('React Native API assumption: <TextInput> with nested Text renders single host element', () => {
87+
const view = render(
88+
<TextInput testID="test" placeholder="Placeholder">
89+
<Text>Hello</Text>
90+
</TextInput>
91+
);
92+
93+
expect(view.toJSON()).toMatchInlineSnapshot(`
94+
<TextInput
95+
placeholder="Placeholder"
96+
testID="test"
97+
>
98+
<Text>
99+
Hello
100+
</Text>
101+
</TextInput>
102+
`);
103+
});
104+
85105
test('React Native API assumption: <Switch> renders single host element', () => {
86106
const view = render(
87107
<Switch testID="test" value={true} onChange={jest.fn()} />
88108
);
89-
expect(view.getByTestId('test')).toBe(view.getByTestId('test'));
90109

91110
expect(view.toJSON()).toMatchInlineSnapshot(`
92111
<RCTSwitch

0 commit comments

Comments
 (0)