1
1
import React from 'react'
2
2
import { act } from 'react'
3
- import renderer from 'react-test-renderer'
3
+ import testRenderer from 'react-test-renderer'
4
4
import { ThemeProvider } from '@emotion/react'
5
5
import styled , { css } from '@emotion/native'
6
6
import reactNative from 'react-native'
@@ -30,7 +30,7 @@ describe('Emotion native styled', () => {
30
30
`
31
31
const tree = (
32
32
await act ( ( ) =>
33
- renderer . create (
33
+ testRenderer . create (
34
34
< Text style = { { fontSize : 40 } } back = "red" >
35
35
Emotion Primitives
36
36
</ Text >
@@ -47,7 +47,7 @@ describe('Emotion native styled', () => {
47
47
48
48
const tree = (
49
49
await act ( ( ) =>
50
- renderer . create (
50
+ testRenderer . create (
51
51
< ThemeProvider theme = { theme } >
52
52
< Text > Hello World</ Text >
53
53
</ ThemeProvider >
@@ -64,7 +64,7 @@ describe('Emotion native styled', () => {
64
64
} ) )
65
65
const tree = (
66
66
await act ( ( ) =>
67
- renderer . create ( < Text decor = "hotpink" > Emotion Primitives</ Text > )
67
+ testRenderer . create ( < Text decor = "hotpink" > Emotion Primitives</ Text > )
68
68
)
69
69
) . toJSON ( )
70
70
expect ( tree ) . toMatchSnapshot ( )
@@ -76,7 +76,7 @@ describe('Emotion native styled', () => {
76
76
`
77
77
const tree = (
78
78
await act ( ( ) =>
79
- renderer . create (
79
+ testRenderer . create (
80
80
< Title style = { { padding : 10 } } > Emotion primitives</ Title >
81
81
)
82
82
)
@@ -91,7 +91,7 @@ describe('Emotion native styled', () => {
91
91
`
92
92
const tree = (
93
93
await act ( ( ) =>
94
- renderer . create ( < Text style = { styles . foo } > Emotion primitives</ Text > )
94
+ testRenderer . create ( < Text style = { styles . foo } > Emotion primitives</ Text > )
95
95
)
96
96
) . toJSON ( )
97
97
expect ( tree ) . toMatchSnapshot ( )
@@ -103,7 +103,7 @@ describe('Emotion native styled', () => {
103
103
`
104
104
const Name = Text . withComponent ( reactNative . Text )
105
105
const tree = (
106
- await act ( ( ) => renderer . create ( < Name decor = "hotpink" > Mike</ Name > ) )
106
+ await act ( ( ) => testRenderer . create ( < Name decor = "hotpink" > Mike</ Name > ) )
107
107
) . toJSON ( )
108
108
expect ( tree ) . toMatchSnapshot ( )
109
109
} )
@@ -118,7 +118,7 @@ describe('Emotion native styled', () => {
118
118
font-style: ${ props => props . sty } ;
119
119
`
120
120
const tree = (
121
- await act ( ( ) => renderer . create ( < StyledTitle sty = "italic" /> ) )
121
+ await act ( ( ) => testRenderer . create ( < StyledTitle sty = "italic" /> ) )
122
122
) . toJSON ( )
123
123
expect ( tree ) . toMatchSnapshot ( )
124
124
} )
@@ -127,10 +127,12 @@ describe('Emotion native styled', () => {
127
127
const ViewOne = styled . View `
128
128
background-color: ${ props => props . color } ;
129
129
`
130
- const treeOne = await act ( ( ) => renderer . create ( < ViewOne color = "green" /> ) )
130
+ const treeOne = await act ( ( ) =>
131
+ testRenderer . create ( < ViewOne color = "green" /> )
132
+ )
131
133
const ViewTwo = ViewOne . withComponent ( reactNative . Text )
132
134
const treeTwo = await act ( ( ) =>
133
- renderer . create ( < ViewTwo color = "hotpink" /> )
135
+ testRenderer . create ( < ViewTwo color = "hotpink" /> )
134
136
)
135
137
136
138
expect ( treeOne ) . toMatchSnapshot ( )
@@ -143,7 +145,7 @@ describe('Emotion native styled', () => {
143
145
`
144
146
const tree = (
145
147
await act ( ( ) =>
146
- renderer . create (
148
+ testRenderer . create (
147
149
< Image
148
150
source = { {
149
151
uri : 'https://camo.githubusercontent.com/209bdea972b9b6ef90220c59ecbe66d35ffefa8a/68747470733a2f2f63646e2e7261776769742e636f6d2f746b6834342f656d6f74696f6e2f6d61737465722f656d6f74696f6e2e706e67' ,
@@ -164,7 +166,7 @@ describe('Emotion native styled', () => {
164
166
padding: 20;
165
167
`
166
168
167
- await act ( ( ) => renderer . create ( < Text > Hello World</ Text > ) )
169
+ await act ( ( ) => testRenderer . create ( < Text > Hello World</ Text > ) )
168
170
169
171
expect ( console . error ) . toBeCalledWith (
170
172
"'padding' shorthand property requires units for example - padding: 20px or padding: 10px 20px 40px 50px"
@@ -183,7 +185,7 @@ describe('Emotion native styled', () => {
183
185
184
186
const tree = (
185
187
await act ( ( ) =>
186
- renderer . create ( < Text backgroundColor = "blue" > Hello World</ Text > )
188
+ testRenderer . create ( < Text backgroundColor = "blue" > Hello World</ Text > )
187
189
)
188
190
) . toJSON ( )
189
191
0 commit comments