forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAvatar.test.js
55 lines (41 loc) · 1.41 KB
/
Avatar.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
import * as React from 'react';
import renderer from 'react-test-renderer';
import * as Avatar from '../Avatar/Avatar.tsx';
it('renders avatar with text', () => {
const tree = renderer.create(<Avatar.Text label="XD" />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders avatar with text and custom size', () => {
const tree = renderer.create(<Avatar.Text size={96} label="XD" />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders avatar with text and custom background color', () => {
const tree = renderer
.create(<Avatar.Text style={{ backgroundColor: '#FF0000' }} label="XD" />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders avatar with text and custom colors', () => {
const tree = renderer
.create(<Avatar.Text color="#FFFFFF" label="XD" />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders avatar with icon', () => {
const tree = renderer.create(<Avatar.Icon icon="information" />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders avatar with icon and custom background color', () => {
const tree = renderer
.create(
<Avatar.Icon style={{ backgroundColor: '#FF0000' }} icon="information" />
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders avatar with image', () => {
const tree = renderer
.create(<Avatar.Image source={{ src: 'avatar.png' }} />)
.toJSON();
expect(tree).toMatchSnapshot();
});