Address eslint errors:
* modify .eslintrc w/ globals & rules * use judgement in deciding bet proj style & eslint recommendation * make
This commit is contained in:
@@ -11,8 +11,6 @@ var testRandomLayout = layoutTestUtils.testRandomLayout;
|
||||
var computeLayout = layoutTestUtils.computeLayout;
|
||||
var computeDOMLayout = layoutTestUtils.computeDOMLayout;
|
||||
var reduceTest = layoutTestUtils.reduceTest;
|
||||
var text = layoutTestUtils.text;
|
||||
var texts = layoutTestUtils.texts;
|
||||
|
||||
describe('Random layout', function() {
|
||||
|
||||
@@ -39,14 +37,7 @@ describe('Random layout', function() {
|
||||
node.style[attribute] = enumValues[Math.floor(rng.nextFloat() * enumValues.length)];
|
||||
}
|
||||
}
|
||||
function randChildren(node, chance) {
|
||||
while (rng.nextFloat() < chance) {
|
||||
if (!node.children) {
|
||||
node.children = [];
|
||||
}
|
||||
node.children.push(generateRandomNode());
|
||||
}
|
||||
}
|
||||
|
||||
function randSpacing(node, chance, type, suffix, min, max) {
|
||||
randMinMax(node, chance, type + suffix, min, max);
|
||||
randMinMax(node, chance, type + 'Left' + suffix, min, max);
|
||||
@@ -88,10 +79,29 @@ describe('Random layout', function() {
|
||||
delete node.style.position;
|
||||
}
|
||||
|
||||
function randChildren(node, chance) {
|
||||
while (rng.nextFloat() < chance) {
|
||||
if (!node.children) {
|
||||
node.children = [];
|
||||
}
|
||||
node.children.push(generateRandomNode());
|
||||
}
|
||||
}
|
||||
|
||||
randChildren(node, 0.4);
|
||||
return node;
|
||||
}
|
||||
|
||||
function checkRandomLayout(i, node) {
|
||||
it('should layout randomly #' + i + '.', function(node) {
|
||||
if (JSON.stringify(computeLayout(node)) !== JSON.stringify(computeDOMLayout(node))) {
|
||||
node = reduceTest(node);
|
||||
}
|
||||
|
||||
testRandomLayout(node, i);
|
||||
}.bind(this, node));
|
||||
}
|
||||
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
var node = generateRandomNode();
|
||||
// The iframe's body has a natural width of 300 that it doesn't really make
|
||||
@@ -101,13 +111,7 @@ describe('Random layout', function() {
|
||||
delete node.style.flex;
|
||||
delete node.style.position;
|
||||
|
||||
it('should layout randomly #' + i +'.', function(node) {
|
||||
if (JSON.stringify(computeLayout(node)) !== JSON.stringify(computeDOMLayout(node))) {
|
||||
node = reduceTest(node);
|
||||
}
|
||||
|
||||
testRandomLayout(node, i);
|
||||
}.bind(this, node));
|
||||
checkRandomLayout.call(this, i, node);
|
||||
}
|
||||
|
||||
});
|
||||
|
@@ -50,7 +50,7 @@ describe('Layout', function() {
|
||||
{width: 500, height: 500, top: 0, left: 0},
|
||||
{width: 500, height: 500, top: 500, left: 0, children: [
|
||||
{width: 250, height: 250, top: 0, left: 0},
|
||||
{width: 250, height: 250, top: 250, left: 0},
|
||||
{width: 250, height: 250, top: 250, left: 0}
|
||||
]}
|
||||
]}
|
||||
);
|
||||
@@ -217,7 +217,7 @@ describe('Layout', function() {
|
||||
it('should layout node with flex override height', function() {
|
||||
testLayout(
|
||||
{style: {width: 1000, height: 1000}, children: [
|
||||
{style: {width: 100, height: 100, flex: 1}},
|
||||
{style: {width: 100, height: 100, flex: 1}}
|
||||
]},
|
||||
{width: 1000, height: 1000, top: 0, left: 0, children: [
|
||||
{width: 100, height: 1000, top: 0, left: 0}
|
||||
@@ -233,7 +233,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 1000, height: 1000, top: 0, left: 0, children: [
|
||||
{width: 200, height: 100, top: 0, left: 0},
|
||||
{width: 100, height: 100, top: 100, left: 0},
|
||||
{width: 100, height: 100, top: 100, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -246,7 +246,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 1000, height: 1000, top: 0, left: 0, children: [
|
||||
{width: 200, height: 100, top: 0, left: 400},
|
||||
{width: 100, height: 100, top: 100, left: 450},
|
||||
{width: 100, height: 100, top: 100, left: 450}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -259,7 +259,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 1000, height: 1000, top: 0, left: 0, children: [
|
||||
{width: 200, height: 100, top: 0, left: 800},
|
||||
{width: 100, height: 100, top: 100, left: 900},
|
||||
{width: 100, height: 100, top: 100, left: 900}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -272,7 +272,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 1000, height: 1000, top: 0, left: 0, children: [
|
||||
{width: 200, height: 100, top: 0, left: 800},
|
||||
{width: 100, height: 100, top: 100, left: 450},
|
||||
{width: 100, height: 100, top: 100, left: 450}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -314,7 +314,7 @@ describe('Layout', function() {
|
||||
testLayout(
|
||||
{style: {height: 100}, children: [
|
||||
{style: {height: 100}},
|
||||
{style: {height: 200}},
|
||||
{style: {height: 200}}
|
||||
]},
|
||||
{width: 0, height: 100, top: 0, left: 0, children: [
|
||||
{width: 0, height: 100, top: 0, left: 0},
|
||||
@@ -361,7 +361,7 @@ describe('Layout', function() {
|
||||
it('should layout flex inside of an empty element', function() {
|
||||
testLayout(
|
||||
{style: {}, children: [
|
||||
{style: {flex: 1}},
|
||||
{style: {flex: 1}}
|
||||
]},
|
||||
{width: 0, height: 0, top: 0, left: 0, children: [
|
||||
{width: 0, height: 0, top: 0, left: 0}
|
||||
@@ -483,7 +483,7 @@ describe('Layout', function() {
|
||||
{style: {width: 500, flexDirection: 'row'}, children: [
|
||||
{style: {flex: 1}},
|
||||
{style: {position: 'absolute', width: 50}},
|
||||
{style: {flex: 1}},
|
||||
{style: {flex: 1}}
|
||||
]},
|
||||
{width: 500, height: 0, top: 0, left: 0, children: [
|
||||
{width: 250, height: 0, top: 0, left: 0},
|
||||
@@ -685,7 +685,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 0, height: 500, top: 0, left: 0, children: [
|
||||
{width: 0, height: 500, top: 0, left: 0},
|
||||
{width: 0, height: 0, top: 500, left: 0},
|
||||
{width: 0, height: 0, top: 500, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -932,7 +932,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 100, height: 100, top: 0, left: 0, children: [
|
||||
{width: 0, height: 25, top: 0, left: 0},
|
||||
{width: 0, height: 75, top: 25, left: 0},
|
||||
{width: 0, height: 75, top: 25, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -945,7 +945,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 100, height: 100, top: 0, left: 0, children: [
|
||||
{width: 0, height: 0, top: 0, left: 0},
|
||||
{width: 0, height: 0, top: 0, left: 0},
|
||||
{width: 0, height: 0, top: 0, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -958,7 +958,7 @@ describe('Layout', function() {
|
||||
]},
|
||||
{width: 50, height: 100, top: 0, left: 0, children: [
|
||||
{width: 50, height: 100, top: 0, left: 0},
|
||||
{width: 50, height: 0, top: 100, left: 0},
|
||||
{width: 50, height: 0, top: 100, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
@@ -1150,7 +1150,7 @@ describe('Layout', function() {
|
||||
{style: {flexWrap: 'wrap', flexDirection: 'row', width: 100}, children: [
|
||||
{style: {width: 40, height: 10}},
|
||||
{style: {width: 40, height: 10}},
|
||||
{style: {width: 40, height: 10}},
|
||||
{style: {width: 40, height: 10}}
|
||||
]},
|
||||
{width: 100, height: 20, top: 0, left: 0, children: [
|
||||
{width: 40, height: 10, top: 0, left: 0},
|
||||
@@ -1164,7 +1164,7 @@ describe('Layout', function() {
|
||||
testLayout(
|
||||
{style: {height: 100, flexWrap: 'wrap'}, children: [
|
||||
{style: {height: 100}},
|
||||
{style: {height: 200}},
|
||||
{style: {height: 200}}
|
||||
]},
|
||||
{width: 0, height: 100, top: 0, left: 0, children: [
|
||||
{width: 0, height: 100, top: 0, left: 0},
|
||||
@@ -1209,4 +1209,3 @@ describe('Layout', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user