Skip to content

Commit bc8c001

Browse files
test: fix tests after removal of middle layer in Surface
1 parent 2d860be commit bc8c001

17 files changed

+16584
-17631
lines changed

src/components/__tests__/Appbar/__snapshots__/Appbar.test.tsx.snap

Lines changed: 622 additions & 692 deletions
Large diffs are not rendered by default.

src/components/__tests__/Card/__snapshots__/Card.test.tsx.snap

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ exports[`Card renders an outlined card 1`] = `
3333
collapsable={false}
3434
style={
3535
Object {
36+
"backgroundColor": "rgba(255, 251, 254, 1)",
37+
"borderRadius": 12,
38+
"elevation": 1,
3639
"flex": undefined,
3740
"shadowColor": "#000",
3841
"shadowOffset": Object {
@@ -43,65 +46,52 @@ exports[`Card renders an outlined card 1`] = `
4346
"shadowRadius": 0,
4447
}
4548
}
46-
testID="card-container-middle-layer"
49+
testID="card-container"
4750
>
4851
<View
49-
collapsable={false}
52+
pointerEvents="none"
5053
style={
54+
Array [
55+
Object {
56+
"borderColor": "rgba(121, 116, 126, 1)",
57+
"borderRadius": 12,
58+
},
59+
Object {
60+
"borderWidth": 1,
61+
"height": "100%",
62+
"position": "absolute",
63+
"width": "100%",
64+
"zIndex": 2,
65+
},
66+
]
67+
}
68+
testID="card-outline"
69+
/>
70+
<View
71+
accessibilityState={
5172
Object {
52-
"backgroundColor": "rgba(255, 251, 254, 1)",
53-
"borderRadius": 12,
54-
"elevation": 1,
55-
"flex": undefined,
73+
"disabled": true,
5674
}
5775
}
58-
testID="card-container"
59-
>
60-
<View
61-
pointerEvents="none"
62-
style={
63-
Array [
64-
Object {
65-
"borderColor": "rgba(121, 116, 126, 1)",
66-
"borderRadius": 12,
67-
},
68-
Object {
69-
"borderWidth": 1,
70-
"height": "100%",
71-
"position": "absolute",
72-
"width": "100%",
73-
"zIndex": 2,
74-
},
75-
]
76-
}
77-
testID="card-outline"
78-
/>
79-
<View
80-
accessibilityState={
76+
accessible={true}
77+
focusable={false}
78+
onClick={[Function]}
79+
onResponderGrant={[Function]}
80+
onResponderMove={[Function]}
81+
onResponderRelease={[Function]}
82+
onResponderTerminate={[Function]}
83+
onResponderTerminationRequest={[Function]}
84+
onStartShouldSetResponder={[Function]}
85+
style={
86+
Array [
8187
Object {
82-
"disabled": true,
83-
}
84-
}
85-
accessible={true}
86-
focusable={false}
87-
onClick={[Function]}
88-
onResponderGrant={[Function]}
89-
onResponderMove={[Function]}
90-
onResponderRelease={[Function]}
91-
onResponderTerminate={[Function]}
92-
onResponderTerminationRequest={[Function]}
93-
onStartShouldSetResponder={[Function]}
94-
style={
95-
Array [
96-
Object {
97-
"flexShrink": 1,
98-
},
99-
undefined,
100-
]
101-
}
102-
testID="card"
103-
/>
104-
</View>
88+
"flexShrink": 1,
89+
},
90+
undefined,
91+
]
92+
}
93+
testID="card"
94+
/>
10595
</View>
10696
</View>
10797
`;

src/components/__tests__/Surface.test.tsx

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -71,43 +71,26 @@ describe('Surface', () => {
7171
);
7272

7373
expect(getByTestId('surface-test-outer-layer')).toHaveStyle(style);
74-
expect(getByTestId('surface-test-middle-layer')).not.toHaveStyle(style);
7574
expect(getByTestId('surface-test')).not.toHaveStyle(style);
7675
});
7776

78-
it.each`
79-
property | value
80-
${'padding'} | ${12}
81-
${'paddingLeft'} | ${12.1}
82-
${'paddingRight'} | ${12.2}
83-
${'paddingTop'} | ${12.3}
84-
${'paddingBottom'} | ${12.4}
85-
${'paddingHorizontal'} | ${12.5}
86-
${'paddingVertical'} | ${12.6}
87-
${'borderWidth'} | ${2}
88-
${'borderColor'} | ${'black'}
89-
`('applies $property to inner layer only', ({ property, value }) => {
90-
const style = { [property]: value };
91-
92-
const { getByTestId } = render(
93-
<Surface testID="surface-test" style={style}>
94-
{null}
95-
</Surface>
96-
);
97-
98-
expect(getByTestId('surface-test-outer-layer')).not.toHaveStyle(style);
99-
expect(getByTestId('surface-test-middle-layer')).not.toHaveStyle(style);
100-
expect(getByTestId('surface-test')).toHaveStyle(style);
101-
});
102-
10377
it.each`
10478
property | value
79+
${'padding'} | ${12}
80+
${'paddingLeft'} | ${12.1}
81+
${'paddingRight'} | ${12.2}
82+
${'paddingTop'} | ${12.3}
83+
${'paddingBottom'} | ${12.4}
84+
${'paddingHorizontal'} | ${12.5}
85+
${'paddingVertical'} | ${12.6}
86+
${'borderWidth'} | ${2}
87+
${'borderColor'} | ${'black'}
10588
${'borderRadius'} | ${3}
10689
${'borderTopLeftRadius'} | ${1}
10790
${'borderTopRightRadius'} | ${2}
10891
${'borderBottomLeftRadius'} | ${3}
10992
${'borderBottomRightRadius'} | ${4}
110-
`('applies $property to inner layer', ({ property, value }) => {
93+
`('applies $property to inner layer only', ({ property, value }) => {
11194
const style = { [property]: value };
11295

11396
const { getByTestId } = render(
@@ -117,7 +100,6 @@ describe('Surface', () => {
117100
);
118101

119102
expect(getByTestId('surface-test-outer-layer')).not.toHaveStyle(style);
120-
expect(getByTestId('surface-test-middle-layer')).not.toHaveStyle(style);
121103
expect(getByTestId('surface-test')).toHaveStyle(style);
122104
});
123105

@@ -179,7 +161,6 @@ describe('Surface', () => {
179161

180162
const style = { backgroundColor };
181163
expect(getByTestId('surface-test-outer-layer')).not.toHaveStyle(style);
182-
expect(getByTestId('surface-test-middle-layer')).not.toHaveStyle(style);
183164
expect(getByTestId('surface-test')).toHaveStyle(style);
184165
});
185166

0 commit comments

Comments
 (0)