-
-
Notifications
You must be signed in to change notification settings - Fork 649
/
Copy pathflex-align-self.tsx
78 lines (66 loc) · 1.44 KB
/
flex-align-self.tsx
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
import React from 'react';
import test from 'ava';
import {Box, Text} from '../src/index.js';
import {renderToString} from './helpers/render-to-string.js';
test('row - align text to center', t => {
const output = renderToString(
<Box height={3}>
<Box alignSelf="center">
<Text>Test</Text>
</Box>
</Box>,
);
t.is(output, '\nTest\n');
});
test('row - align multiple text nodes to center', t => {
const output = renderToString(
<Box height={3}>
<Box alignSelf="center">
<Text>A</Text>
<Text>B</Text>
</Box>
</Box>,
);
t.is(output, '\nAB\n');
});
test('row - align text to bottom', t => {
const output = renderToString(
<Box height={3}>
<Box alignSelf="flex-end">
<Text>Test</Text>
</Box>
</Box>,
);
t.is(output, '\n\nTest');
});
test('row - align multiple text nodes to bottom', t => {
const output = renderToString(
<Box height={3}>
<Box alignSelf="flex-end">
<Text>A</Text>
<Text>B</Text>
</Box>
</Box>,
);
t.is(output, '\n\nAB');
});
test('column - align text to center', t => {
const output = renderToString(
<Box flexDirection="column" width={10}>
<Box alignSelf="center">
<Text>Test</Text>
</Box>
</Box>,
);
t.is(output, ' Test');
});
test('column - align text to right', t => {
const output = renderToString(
<Box flexDirection="column" width={10}>
<Box alignSelf="flex-end">
<Text>Test</Text>
</Box>
</Box>,
);
t.is(output, ' Test');
});