wooooot, padding works!
This commit is contained in:
@@ -512,7 +512,6 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should layout node with inner & outer padding and stretch', function() {
|
it('should layout node with inner & outer padding and stretch', function() {
|
||||||
testLayout(
|
testLayout(
|
||||||
{style: {padding: 50}, children: [
|
{style: {padding: 50}, children: [
|
||||||
@@ -524,6 +523,22 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should layout node with stretch and child with margin', function() {
|
||||||
|
testLayout(
|
||||||
|
{style: {}, children: [
|
||||||
|
{style: {alignSelf: 'stretch'}, children: [
|
||||||
|
{style: {margin: 16}}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
|
||||||
|
{width: 32, height: 32, top: 0, left: 0, children: [
|
||||||
|
{width: 32, height: 32, top: 0, left: 0, children: [
|
||||||
|
{width: 0, height: 0, top: 16, left: 16}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should layout randomly', function() {
|
it('should layout randomly', function() {
|
||||||
function RNG(seed) {
|
function RNG(seed) {
|
||||||
this.state = seed;
|
this.state = seed;
|
||||||
|
@@ -202,13 +202,11 @@ function computeLayout(node) {
|
|||||||
} else if (alignItem === 'flex-end') {
|
} else if (alignItem === 'flex-end') {
|
||||||
leadingCrossDim += remainingCrossDim;
|
leadingCrossDim += remainingCrossDim;
|
||||||
} else if (alignItem === 'stretch') {
|
} else if (alignItem === 'stretch') {
|
||||||
child.layout[dim[crossAxis]] += node.layout[dim[crossAxis]] -
|
child.layout[dim[crossAxis]] = node.layout[dim[crossAxis]] -
|
||||||
getPadding(node, leading[crossAxis]) -
|
getPadding(node, leading[crossAxis]) -
|
||||||
getPadding(node, trailing[crossAxis]) -
|
getPadding(node, trailing[crossAxis]) -
|
||||||
getMargin(child, leading[crossAxis]) -
|
getMargin(child, leading[crossAxis]) -
|
||||||
getMargin(child, trailing[crossAxis]) -
|
getMargin(child, trailing[crossAxis]);
|
||||||
getPadding(child, leading[crossAxis]) -
|
|
||||||
getPadding(child, trailing[crossAxis]);
|
|
||||||
}
|
}
|
||||||
child.layout[pos[crossAxis]] += leadingCrossDim;
|
child.layout[pos[crossAxis]] += leadingCrossDim;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user