[src/Layout-test-utils.js]: Added inplaceRoundNumbersInObject to testRandomLayout so that much less random tests fail ; Moved inplaceRoundNumbersInObject in the main functions instead of having it in nameLayout ;
This commit is contained in:
@@ -265,7 +265,6 @@ var layoutTestUtils = (function() {
|
|||||||
for (var key in layout) {
|
for (var key in layout) {
|
||||||
namedLayout[key] = layout[key];
|
namedLayout[key] = layout[key];
|
||||||
}
|
}
|
||||||
inplaceRoundNumbersInObject(namedLayout);
|
|
||||||
return namedLayout;
|
return namedLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,19 +425,28 @@ var layoutTestUtils = (function() {
|
|||||||
testLayout: function(node, expectedLayout) {
|
testLayout: function(node, expectedLayout) {
|
||||||
var layout = computeCSSLayout(node);
|
var layout = computeCSSLayout(node);
|
||||||
var domLayout = computeDOMLayout(node);
|
var domLayout = computeDOMLayout(node);
|
||||||
|
inplaceRoundNumbersInObject(layout);
|
||||||
|
inplaceRoundNumbersInObject(domLayout);
|
||||||
|
inplaceRoundNumbersInObject(expectedLayout);
|
||||||
testNamedLayout('expected-dom', expectedLayout, domLayout);
|
testNamedLayout('expected-dom', expectedLayout, domLayout);
|
||||||
testNamedLayout('layout-dom', layout, domLayout);
|
testNamedLayout('layout-dom', layout, domLayout);
|
||||||
},
|
},
|
||||||
testLayoutAgainstDomOnly: function(node, expectedLayout) {
|
testLayoutAgainstDomOnly: function(node, expectedLayout) {
|
||||||
var layout = computeCSSLayout(node);
|
var layout = computeCSSLayout(node);
|
||||||
var domLayout = computeDOMLayout(node);
|
var domLayout = computeDOMLayout(node);
|
||||||
|
inplaceRoundNumbersInObject(layout);
|
||||||
|
inplaceRoundNumbersInObject(domLayout);
|
||||||
testNamedLayout('layout-dom', layout, domLayout);
|
testNamedLayout('layout-dom', layout, domLayout);
|
||||||
},
|
},
|
||||||
testFillNodes: testFillNodes,
|
testFillNodes: testFillNodes,
|
||||||
testExtractNodes: testExtractNodes,
|
testExtractNodes: testExtractNodes,
|
||||||
testRandomLayout: function(node) {
|
testRandomLayout: function(node) {
|
||||||
expect({node: node, layout: computeCSSLayout(node)})
|
var layout = computeCSSLayout(node);
|
||||||
.toEqual({node: node, layout: computeDOMLayout(node)});
|
var domLayout = computeDOMLayout(node);
|
||||||
|
inplaceRoundNumbersInObject(layout);
|
||||||
|
inplaceRoundNumbersInObject(domLayout);
|
||||||
|
expect({node: node, layout: layout})
|
||||||
|
.toEqual({node: node, layout: domLayout});
|
||||||
},
|
},
|
||||||
testsFinished: function() {
|
testsFinished: function() {
|
||||||
console.log('tests finished!');
|
console.log('tests finished!');
|
||||||
|
Reference in New Issue
Block a user