Added extra test to check for potential division by zero.

This commit is contained in:
Russell Keith-Magee
2015-04-01 14:46:28 +08:00
parent 8ae56041b5
commit 9cf2e71e01
3 changed files with 259 additions and 13 deletions

View File

@@ -1302,7 +1302,7 @@ describe('Layout', function() {
it('should override flex direction size with min bounds', function() {
testLayout(
{style: {width: 300, height: 200, flexDirection:'row'}, children: [
{style: {width: 300, height: 200, flexDirection: 'row'}, children: [
{style: {flex: 1}},
{style: {flex: 1, minWidth: 200}},
{style: {flex: 1}}
@@ -1332,7 +1332,7 @@ describe('Layout', function() {
it('should override flex direction size with max bounds', function() {
testLayout(
{style: {width: 300, height: 200, flexDirection:'row'}, children: [
{style: {width: 300, height: 200, flexDirection: 'row'}, children: [
{style: {flex: 1}},
{style: {flex: 1, maxWidth: 60}},
{style: {flex: 1}}
@@ -1345,6 +1345,36 @@ describe('Layout', function() {
);
});
it ('should ignore flex size if fully max bound', function() {
testLayout(
{style: {width: 300, height: 200, flexDirection: 'row'}, children: [
{style: {flex: 1, maxWidth: 60}},
{style: {flex: 1, maxWidth: 60}},
{style: {flex: 1, maxWidth: 60}}
]},
{width: 300, height: 200, top: 0, left: 0, children: [
{width: 60, height: 200, top: 0, left: 0},
{width: 60, height: 200, top: 0, left: 60},
{width: 60, height: 200, top: 0, left: 120}
]}
);
});
it ('should ignore flex size if fully min bound', function() {
testLayout(
{style: {width: 300, height: 200, flexDirection: 'row'}, children: [
{style: {flex: 1, minWidth: 120}},
{style: {flex: 1, minWidth: 120}},
{style: {flex: 1, minWidth: 120}}
]},
{width: 300, height: 200, top: 0, left: 0, children: [
{width: 120, height: 200, top: 0, left: 0},
{width: 120, height: 200, top: 0, left: 120},
{width: 120, height: 200, top: 0, left: 240}
]}
);
});
it('should pre-fill child size within bounds', function() {
testLayout(
{style: {width: 300, height: 200}, children: [