Skip to content

Commit 0219cec

Browse files
committed
test: render a real control in the centered icon button test
1 parent c217ae2 commit 0219cec

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎src/components/__tests__/IconButton.test.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,35 @@ it('renders icon button with small border radius', async () => {
9292
});
9393

9494
it('keeps touchable content centered with custom container style', async () => {
95-
await render(<IconButton icon="delete" style={styles.customBackground} />);
95+
await render(
96+
<IconButton
97+
icon="delete"
98+
onPress={() => {}}
99+
style={styles.customBackground}
100+
/>
101+
);
96102
expect(screen.getByRole('button')).toHaveStyle({
97103
flex: 1,
98104
justifyContent: 'center',
99105
alignItems: 'center',
100106
});
101107
});
102108

109+
it('keeps handler-less content centered with custom container style', async () => {
110+
await render(
111+
<IconButton
112+
icon="delete"
113+
testID="icon-button"
114+
style={styles.customBackground}
115+
/>
116+
);
117+
expect(screen.getByTestId('icon-button')).toHaveStyle({
118+
flex: 1,
119+
justifyContent: 'center',
120+
alignItems: 'center',
121+
});
122+
});
123+
103124
describe('getIconButtonColor - icon color', () => {
104125
it('should return custom icon color', () => {
105126
expect(

‎src/components/__tests__/__snapshots__/TextInput.test.tsx.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ exports[`dims a disabled TextInput with TextInput.Icon accessories exactly once
225225
[
226226
{
227227
"alignItems": "center",
228-
"flexGrow": 1,
228+
"flex": 1,
229229
"justifyContent": "center",
230230
},
231231
{
@@ -430,7 +430,7 @@ exports[`dims a disabled TextInput with TextInput.Icon accessories exactly once
430430
[
431431
{
432432
"alignItems": "center",
433-
"flexGrow": 1,
433+
"flex": 1,
434434
"justifyContent": "center",
435435
},
436436
{

0 commit comments

Comments
 (0)