forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBanner.test.js
95 lines (84 loc) · 2.35 KB
/
Banner.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import * as React from 'react';
import renderer from 'react-test-renderer';
import { Image } from 'react-native';
import Banner from '../Banner.tsx';
jest.useFakeTimers();
it('renders hidden banner, without action buttons and without image', () => {
const tree = renderer
.create(
<Banner visible={false} actions={[]}>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders visible banner, without action buttons and without image', () => {
const tree = renderer
.create(
<Banner visible actions={[]}>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders visible banner, with action buttons and without image', () => {
const tree = renderer
.create(
<Banner
visible
actions={[
{ label: 'first', onPress: () => {} },
{ label: 'second', onPress: () => {} },
]}
>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders visible banner, without action buttons and with image', () => {
const tree = renderer
.create(
<Banner
visible
image={({ size }) => (
<Image
source={{ uri: 'https://callstack.com/images/team/Satya.png' }}
style={{ width: size, height: size }}
/>
)}
actions={[]}
>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders visible banner, with action buttons and with image', () => {
const tree = renderer
.create(
<Banner
visible
image={({ size }) => (
<Image
source={{ uri: 'https://callstack.com/images/team/Satya.png' }}
style={{ width: size, height: size }}
/>
)}
actions={[{ label: 'first', onPress: () => {} }]}
>
Two line text string with two actions. One to two lines is preferable on
mobile.
</Banner>
)
.toJSON();
expect(tree).toMatchSnapshot();
});