auto reduce test cases in randomly generated tests and fix position absolute within space-around

This commit is contained in:
Christopher Chedeau
2014-04-22 09:32:49 -07:00
parent 37c518943e
commit f5b738338d
3 changed files with 29 additions and 15 deletions

View File

@@ -109,14 +109,6 @@ var layoutTestUtils = (function() {
return JSON.stringify(a) === JSON.stringify(b);
}
function printNode(node) {
console.log(
JSON.stringify(node)
.replace(/"([a-zA-Z]+)":/g, '$1: ')
.replace(/,/g, ', ')
.replace(/"/g, '\'')
);
}
function reduceTest(node) {
function isWorking() {
return isEqual(
@@ -125,7 +117,7 @@ var layoutTestUtils = (function() {
);
}
if (isWorking()) {
return console.log('Bail early, already working');
return node;
}
var isModified = true;
@@ -180,9 +172,7 @@ var layoutTestUtils = (function() {
rec(node);
}
printNode(node);
printNode(computeDOMLayout(node));
printNode(computeLayout(node));
return node;
}
return {
@@ -196,6 +186,7 @@ var layoutTestUtils = (function() {
expect({i: i, node: node, layout: computeLayout(node)})
.toEqual({i: i, node: node, layout: computeDOMLayout(node)});
},
computeLayout: computeLayout,
computeDOMLayout: computeDOMLayout,
reduceTest: reduceTest
}