Updated the public API to no-longer extract nodes

This commit is contained in:
Colin Eberhardt
2015-08-13 08:39:28 +01:00
parent 0de0186fbd
commit f9bb74aedf
9 changed files with 121 additions and 88 deletions

View File

@@ -114,10 +114,25 @@ var layoutTestUtils = (function() {
if (typeof computeLayout === 'object') {
var fillNodes = computeLayout.fillNodes;
var extractNodes = computeLayout.extractNodes;
var realComputeLayout = computeLayout.computeLayout;
}
function extractNodes(node) {
var layout = node.layout;
delete node.layout;
if (node.children && node.children.length > 0) {
layout.children = node.children.map(extractNodes);
} else {
delete node.children;
}
delete layout.right;
delete layout.bottom;
delete layout.direction;
return layout;
}
function roundLayout(layout) {
// Chrome rounds all the numbers with a precision of 1/64
// Reproduce the same behavior