forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathButton.test.js
74 lines (56 loc) · 1.74 KB
/
Button.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
import * as React from 'react';
import renderer from 'react-test-renderer';
import Button from '../Button.tsx';
import { pink500 } from '../../styles/colors.tsx';
it('renders text button by default', () => {
const tree = renderer.create(<Button>Text Button</Button>).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders text button with mode', () => {
const tree = renderer
.create(<Button mode="text">Text Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders outlined button with mode', () => {
const tree = renderer
.create(<Button mode="outlined">Outlined Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders contained contained with mode', () => {
const tree = renderer
.create(<Button mode="contained">Contained Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders button with icon', () => {
const tree = renderer
.create(<Button icon="camera">Icon Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders loading button', () => {
const tree = renderer
.create(<Button loading>Loading Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders disabled button', () => {
const tree = renderer
.create(<Button disabled>Disabled Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders button with color', () => {
const tree = renderer
.create(<Button color={pink500}>Custom Button</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders button with custom testID', () => {
const tree = renderer
.create(<Button testID={'custom:testID'}>Button with custom testID</Button>)
.toJSON();
expect(tree).toMatchSnapshot();
});