add tests for flexWrap

This commit is contained in:
Christopher Chedeau
2014-12-11 13:57:03 +00:00
parent e0bcbdcfc1
commit ef73ebd935
2 changed files with 19 additions and 2 deletions

View File

@@ -71,7 +71,8 @@ describe('Random layout', function() {
randEnum(node, 0.5, 'alignItems', ['flex-start', 'center', 'flex-end', 'stretch']); randEnum(node, 0.5, 'alignItems', ['flex-start', 'center', 'flex-end', 'stretch']);
randEnum(node, 0.5, 'alignSelf', ['flex-start', 'center', 'flex-end', 'stretch']); randEnum(node, 0.5, 'alignSelf', ['flex-start', 'center', 'flex-end', 'stretch']);
randEnum(node, 0.5, 'position', ['relative', 'absolute']); randEnum(node, 0.5, 'position', ['relative', 'absolute']);
randEnum(node, 0.5, 'measure', [text(texts.small), text(texts.big)]); //randEnum(node, 0.5, 'flexWrap', ['nowrap', 'wrap']);
//randEnum(node, 0.5, 'measure', [text(texts.small), text(texts.big)]);
if (node.style.measure) { if (node.style.measure) {
// align-items: stretch on a text node makes it wrap in a different way. // align-items: stretch on a text node makes it wrap in a different way.

View File

@@ -1044,7 +1044,7 @@ describe('Layout', function() {
); );
}); });
it('should calcluate left properly with position: absolute right, width, and no parent dimensions', function() { it('should calculate left properly with position: absolute right, width, and no parent dimensions', function() {
testLayout( testLayout(
{style: {}, children: [ {style: {}, children: [
{style: {width: 10, position: 'absolute', right: 0}} {style: {width: 10, position: 'absolute', right: 0}}
@@ -1055,6 +1055,22 @@ describe('Layout', function() {
); );
}); });
xit('should layout flex-wrap', function() {
testLayout(
{style: {flexWrap: 'wrap', flexDirection: 'row', width: 100}, children: [
{style: {width: 40, height: 10}},
{style: {width: 40, height: 10}},
{style: {flex: 1}},
{style: {width: 40, height: 10}},
]},
{width: 100, height: 20, top: 0, left: 0, children: [
{width: 40, height: 10, top: 0, left: 0},
{width: 40, height: 10, top: 0, left: 40},
{width: 40, height: 10, top: 10, left: 0}
]}
);
});
xit('should layout text with alignItems: stretch', function() { xit('should layout text with alignItems: stretch', function() {
testLayout( testLayout(
{style: {width: 80, padding: 7, alignItems: 'stretch', measure: text(texts.big)}}, {style: {width: 80, padding: 7, alignItems: 'stretch', measure: text(texts.big)}},