Compute main dimensions from chidren when not defined

This commit is contained in:
Christopher Chedeau
2014-04-05 11:41:21 -07:00
parent a370fc643b
commit d0ae1ea690
2 changed files with 26 additions and 5 deletions

View File

@@ -71,9 +71,8 @@ function computeDOMLayout(node) {
function testLayout(node, expectedLayout) {
var layout = computeLayout(node);
var domLayout = computeDOMLayout(node);
expect(layout).toEqual(expectedLayout)
expect(layout).toEqual(domLayout);
expect(expectedLayout).toEqual(domLayout);
expect(layout).toEqual(domLayout);
}
describe('Layout', function() {
@@ -178,5 +177,21 @@ describe('Layout', function() {
]
});
});
it('should layout node based on children main dimensions', function() {
testLayout({
style: {width: 300},
children: [
{style: {width: 100, height: 200}},
{style: {width: 300, height: 150}}
]
}, {
width: 300, height: 350, top: 0, left: 0,
children: [
{width: 100, height: 200, top: 0, left: 0},
{width: 300, height: 150, top: 200, left: 0}
]
});
});
});