Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: LayoutTests/resources/check-layout.js

Issue 888743002: Force unitless data-expected attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Redo percentage-height-when-height-specified-by-top-bottom.html onload change Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/resources/check-layout.js
diff --git a/LayoutTests/resources/check-layout.js b/LayoutTests/resources/check-layout.js
index 97f18023d729dd1fe29ca86d8d472589a19c6352..0d617bea3be71dc00385db92ab27b0a8ab6d493d 100644
--- a/LayoutTests/resources/check-layout.js
+++ b/LayoutTests/resources/check-layout.js
@@ -37,63 +37,63 @@ function checkExpectedValues(node, failures)
var output = { checked: false };
var expectedWidth = checkAttribute(output, node, "data-expected-width");
if (expectedWidth) {
- if (Math.abs(node.offsetWidth - expectedWidth) >= 1)
+ if (isNaN(expectedWidth) || Math.abs(node.offsetWidth - expectedWidth) >= 1)
failures.push("Expected " + expectedWidth + " for width, but got " + node.offsetWidth + ". ");
}
var expectedHeight = checkAttribute(output, node, "data-expected-height");
if (expectedHeight) {
- if (Math.abs(node.offsetHeight - expectedHeight) >= 1)
+ if (isNaN(expectedHeight) || Math.abs(node.offsetHeight - expectedHeight) >= 1)
failures.push("Expected " + expectedHeight + " for height, but got " + node.offsetHeight + ". ");
}
var expectedOffset = checkAttribute(output, node, "data-offset-x");
if (expectedOffset) {
- if (Math.abs(node.offsetLeft - expectedOffset) >= 1)
+ if (isNaN(expectedOffset) || Math.abs(node.offsetLeft - expectedOffset) >= 1)
failures.push("Expected " + expectedOffset + " for offsetLeft, but got " + node.offsetLeft + ". ");
}
var expectedOffset = checkAttribute(output, node, "data-offset-y");
if (expectedOffset) {
- if (Math.abs(node.offsetTop - expectedOffset) >= 1)
+ if (isNaN(expectedOffset) || Math.abs(node.offsetTop - expectedOffset) >= 1)
failures.push("Expected " + expectedOffset + " for offsetTop, but got " + node.offsetTop + ". ");
}
var expectedWidth = checkAttribute(output, node, "data-expected-client-width");
if (expectedWidth) {
- if (Math.abs(node.clientWidth - expectedWidth) >= 1)
+ if (isNaN(expectedWidth) || Math.abs(node.clientWidth - expectedWidth) >= 1)
failures.push("Expected " + expectedWidth + " for clientWidth, but got " + node.clientWidth + ". ");
}
var expectedHeight = checkAttribute(output, node, "data-expected-client-height");
if (expectedHeight) {
- if (Math.abs(node.clientHeight - expectedHeight) >= 1)
+ if (isNaN(expectedHeight) || Math.abs(node.clientHeight - expectedHeight) >= 1)
failures.push("Expected " + expectedHeight + " for clientHeight, but got " + node.clientHeight + ". ");
}
var expectedWidth = checkAttribute(output, node, "data-expected-scroll-width");
if (expectedWidth) {
- if (Math.abs(node.scrollWidth - expectedWidth) >= 1)
+ if (isNaN(expectedWidth) || Math.abs(node.scrollWidth - expectedWidth) >= 1)
failures.push("Expected " + expectedWidth + " for scrollWidth, but got " + node.scrollWidth + ". ");
}
var expectedHeight = checkAttribute(output, node, "data-expected-scroll-height");
if (expectedHeight) {
- if (Math.abs(node.scrollHeight - expectedHeight) >= 1)
+ if (isNaN(expectedHeight) || Math.abs(node.scrollHeight - expectedHeight) >= 1)
failures.push("Expected " + expectedHeight + " for scrollHeight, but got " + node.scrollHeight + ". ");
}
var expectedOffset = checkAttribute(output, node, "data-total-x");
if (expectedOffset) {
var totalLeft = node.clientLeft + node.offsetLeft;
- if (Math.abs(totalLeft - expectedOffset) >= 1)
+ if (isNaN(expectedOffset) || Math.abs(totalLeft - expectedOffset) >= 1)
failures.push("Expected " + expectedOffset + " for clientLeft+offsetLeft, but got " + totalLeft + ", clientLeft: " + node.clientLeft + ", offsetLeft: " + node.offsetLeft + ". ");
}
var expectedOffset = checkAttribute(output, node, "data-total-y");
if (expectedOffset) {
var totalTop = node.clientTop + node.offsetTop;
- if (Math.abs(totalTop - expectedOffset) >= 1)
+ if (isNaN(expectedOffset) || Math.abs(totalTop - expectedOffset) >= 1)
failures.push("Expected " + expectedOffset + " for clientTop+offsetTop, but got " + totalTop + ", clientTop: " + node.clientTop + ", + offsetTop: " + node.offsetTop + ". ");
}
Julien - ping for review 2015/02/03 02:42:53 Should we have testing for that in the harness? (I

Powered by Google App Engine
This is Rietveld 408576698