Repository navigation
Expand file tree
/
Copy pathButton.android.js
More file actions
330 lines (317 loc) · 8 KB
/
Copy pathButton.android.js
File metadata and controls
330 lines (317 loc) · 8 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
import { View } from "react-native";
import React from "react";
import renderer from "react-test-renderer";
import { Content } from "./../../src/basic/Content";
// import { View } from "./../../src/basic/View";
import { Button } from "./../../src/basic/Button";
import { Text } from "./../../src/basic/Text";
import { Icon } from "./../../src/basic/Icon";
// Note: test renderer must be required after react-native.
jest.mock("Platform", () => {
const Platform = require.requireActual("Platform");
Platform.OS = "android";
return Platform;
});
it("renders regular button", () => {
const tree = renderer
.create(
<Content>
<Button light>
<Text>Light</Text>
</Button>
<Button info>
<Text>Info</Text>
</Button>
<Button primary>
<Text>Primary</Text>
</Button>
<Button success>
<Text>Success</Text>
</Button>
<Button warning>
<Text>Warning</Text>
</Button>
<Button danger>
<Text>Danger</Text>
</Button>
<Button dark>
<Text>Dark</Text>
</Button>
</Content>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it("renders outline button", () => {
const tree = renderer
.create(
<Content>
<Button bordered light>
<Text>Light</Text>
</Button>
<Button bordered info>
<Text>Info</Text>
</Button>
<Button bordered primary>
<Text>Primary</Text>
</Button>
<Button bordered success>
<Text>Success</Text>
</Button>
<Button bordered warning>
<Text>Warning</Text>
</Button>
<Button bordered danger>
<Text>Danger</Text>
</Button>
<Button bordered dark>
<Text>Dark</Text>
</Button>
</Content>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
// it("renders rounded button", () => {
// const tree = renderer
// .create(
// <Content>
// <Button rounded light>
// <Text>Light</Text>
// </Button>
// <Button rounded info>
// <Text>Info</Text>
// </Button>
// <Button rounded primary>
// <Text>Primary</Text>
// </Button>
// <Button rounded success>
// <Text>Success</Text>
// </Button>
// <Button rounded warning>
// <Text>Warning</Text>
// </Button>
// <Button rounded danger>
// <Text>Danger</Text>
// </Button>
// <Button rounded dark>
// <Text>Dark</Text>
// </Button>
// </Content>
// )
// .toJSON();
// expect(tree).toMatchSnapshot();
// });
it("renders block button", () => {
const tree = renderer
.create(
<Content>
<Button block light>
<Text>Light</Text>
</Button>
<Button block info>
<Text>Info</Text>
</Button>
<Button block primary>
<Text>Primary</Text>
</Button>
<Button block success>
<Text>Success</Text>
</Button>
<Button block warning>
<Text>Warning</Text>
</Button>
<Button block danger>
<Text>Danger</Text>
</Button>
<Button block dark>
<Text>Dark</Text>
</Button>
</Content>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it("renders full button", () => {
const tree = renderer
.create(
<View>
<Button full light>
<Text>Light</Text>
</Button>
<Button full info>
<Text>Info</Text>
</Button>
<Button full primary>
<Text>Primary</Text>
</Button>
<Button full success>
<Text>Success</Text>
</Button>
<Button full warning>
<Text>Warning</Text>
</Button>
<Button full danger>
<Text>Danger</Text>
</Button>
<Button full dark>
<Text>Dark</Text>
</Button>
</View>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it("renders custom size button", () => {
const tree = renderer
.create(
<View>
<Button small>
<Text>Default Small</Text>
</Button>
<Button success>
<Text>Success Default</Text>
</Button>
<Button large dark>
<Text>Dark large</Text>
</Button>
</View>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it("renders transparent button", () => {
const tree = renderer
.create(
<Content>
<Button transparent light>
<Text>Light</Text>
</Button>
<Button transparent info>
<Text>Info</Text>
</Button>
<Button transparent primary>
<Text>Primary</Text>
</Button>
<Button transparent success>
<Text>Success</Text>
</Button>
<Button transparent warning>
<Text>Warning</Text>
</Button>
<Button transparent danger>
<Text>Danger</Text>
</Button>
<Button transparent dark>
<Text>Dark</Text>
</Button>
</Content>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it("renders icon button", () => {
const tree = renderer
.create(
<Content>
<Button iconLeft light>
<Icon active name="arrow-back" />
<Text>Back</Text>
</Button>
<Button light iconRight>
<Text>Next</Text>
<Icon active name="arrow-forward" />
</Button>
<Button light>
<Icon active name="arrow-down" />
</Button>
<Button light>
<Icon active name="arrow-up" />
</Button>
<Button iconLeft>
<Icon active name="home" />
<Text>Home</Text>
</Button>
<Button iconLeft bordered>
<Icon active name="briefcase" />
<Text>Work</Text>
</Button>
<Button iconLeft success>
<Icon active name="people" />
<Text>People</Text>
</Button>
<Button iconLeft success bordered>
<Icon active name="paw" />
<Text>Animals</Text>
</Button>
<Button iconLeft danger>
<Icon active name="close" />
<Text>Trash</Text>
</Button>
<Button danger bordered>
<Icon active name="trash" />
</Button>
<Button danger transparent>
<Icon active name="trash" />
</Button>
<Button iconLeft warning>
<Icon active name="warning" />
<Text>Dont</Text>
</Button>
<Button warning bordered>
<Icon active name="warning" />
</Button>
<Button iconLeft info>
<Icon name="alert" />
<Text>Help</Text>
</Button>
<Button info>
<Icon name="alert" />
</Button>
<Button iconLeft dark>
<Icon active name="cog" />
<Text>Settings</Text>
</Button>
<Button dark transparent>
<Icon active name="cog" />
</Button>
<Button iconLeft transparent>
<Icon active name="beer" />
<Text>Pub</Text>
</Button>
</Content>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it("renders disabled button", () => {
const tree = renderer
.create(
<Content>
<Button disabled>
<Text>Default</Text>
</Button>
<Button disabled bordered>
<Text>Outline</Text>
</Button>
{/* <Button disabled rounded>
<Text>Rounded</Text>
</Button> */}
<Button disabled large>
<Text>Custom</Text>
</Button>
<Button disabled iconRight>
<Text>Icon Button</Text>
<Icon name="home" />
</Button>
<Button disabled block>
<Text>Block</Text>
</Button>
<Button disabled full>
<Text>Full</Text>
</Button>
</Content>
)
.toJSON();
expect(tree).toMatchSnapshot();
});