Skip to content

Commit 66f285c

Browse files
committedJul 11, 2022
add style-hierarchy-test
1 parent 4e33669 commit 66f285c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
import {render, View} from '../reactApeEntry';
3+
import testCanvasSnapshot from '../../../tests/testCanvasSnapshot';
4+
5+
describe('Style hierarchy test', () => {
6+
describe('Test style props hierarchy', () => {
7+
test('backgroundColor and color', () => {
8+
const canvas = document.createElement('canvas');
9+
canvas.height = 100;
10+
canvas.width = 100;
11+
class Layout extends React.Component {
12+
render() {
13+
// Text style should render in orange
14+
// View backgroundColor:
15+
// - 2nd View should have same bgc as 1st
16+
// - 4th should have same bgc as 3rd
17+
return (
18+
<View style={{width: 80, height: 80, backgroundColor: 'grey', color: 'orange'}}>
19+
<View>
20+
<View style={{width: 80, height: 80, backgroundColor: 'powderblue'}}>
21+
<View
22+
style={{
23+
width: 30,
24+
height: 30
25+
}}
26+
>
27+
<Text>should be in orange</Text>
28+
</View>
29+
</View>
30+
</View>
31+
</View>
32+
);
33+
}
34+
}
35+
36+
render(<Layout />, canvas, () => testCanvasSnapshot(expect, canvas));
37+
});
38+
});
39+
});

0 commit comments

Comments
 (0)
Please sign in to comment.