-
-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
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 - no wrap', t => { | ||
const output = renderToString( | ||
<Box width={2}> | ||
<Text>A</Text> | ||
<Text>BC</Text> | ||
</Box> | ||
); | ||
|
||
t.is(output, 'BC\n'); | ||
}); | ||
|
||
test('column - no wrap', t => { | ||
const output = renderToString( | ||
<Box flexDirection="column" height={2}> | ||
<Text>A</Text> | ||
<Text>B</Text> | ||
<Text>C</Text> | ||
</Box> | ||
); | ||
|
||
t.is(output, 'B\nC'); | ||
}); | ||
|
||
test('row - wrap content', t => { | ||
const output = renderToString( | ||
<Box width={2} flexWrap="wrap"> | ||
<Text>A</Text> | ||
<Text>BC</Text> | ||
</Box> | ||
); | ||
|
||
t.is(output, 'A\nBC'); | ||
}); | ||
|
||
test('column - wrap content', t => { | ||
const output = renderToString( | ||
<Box flexDirection="column" height={2} flexWrap="wrap"> | ||
<Text>A</Text> | ||
<Text>B</Text> | ||
<Text>C</Text> | ||
</Box> | ||
); | ||
|
||
t.is(output, 'AC\nB'); | ||
}); | ||
|
||
test('column - wrap content reverse', t => { | ||
const output = renderToString( | ||
<Box flexDirection="column" height={2} width={3} flexWrap="wrap-reverse"> | ||
<Text>A</Text> | ||
<Text>B</Text> | ||
<Text>C</Text> | ||
</Box> | ||
); | ||
|
||
t.is(output, ' CA\n B'); | ||
}); | ||
|
||
test('row - wrap content reverse', t => { | ||
const output = renderToString( | ||
<Box height={3} width={2} flexWrap="wrap-reverse"> | ||
<Text>A</Text> | ||
<Text>B</Text> | ||
<Text>C</Text> | ||
</Box> | ||
); | ||
|
||
t.is(output, '\nC\nAB'); | ||
}); |