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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 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: third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html
index b6bbc7705269f7eb40480320ae8ed2e2d76cbbc1..85120c0b802b77dd80cf964d9e694455934de171 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html
@@ -4,6 +4,76 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/set-progress-properties.js"></script>
+<script>
+description('Test setting valid and invalid properties of HTMLProgressElement.');
+
+var p = document.createElement('progress');
+
+debug("Test values before properties were set");
+shouldBe("p.value", "0");
+shouldBe("p.max", "1");
+shouldBe("p.position", "-1");
+
+debug("Set valid values");
+p.value = 7e1;
+p.max = "1e2";
+shouldBe("p.value", "70");
+shouldBe("p.max", "100");
+shouldBe("p.position", "0.7");
+
+debug("Set value bigger than max");
+p.value = 200;
+p.max = 100.0;
+shouldBe("p.value", "100");
+shouldBe("p.max", "100");
+shouldBe("p.position", "1");
+
+debug("Set value less than zero");
+p.value = -42;
+shouldBe('p.value', '0');
+shouldBe('p.position', '0');
+
+debug("Set invalid value, should throw");
+shouldThrow('p.value = "200A";');
+
+debug("Set invalid max, should throw");
+shouldThrow('p.max = "max";');
+
+debug("Set max to Infinity, should throw");
+shouldThrow('p.max = Infinity;');
+
+debug("Set value to NaN, should throw");
+shouldThrow('p.value = NaN;');
+
+debug("Set value to null and max to 0");
+p.value = null;
+p.max = 0;
+shouldBe("p.value", "0");
+shouldBe("p.max", "1");
+shouldBe("p.position", "0");
+
+debug("Set attributes to valid numbers");
+p.setAttribute("value", 5);
+p.setAttribute("max", 10);
+shouldBe("p.value", "5");
+shouldBe("p.max", "10");
+shouldBe("parseInt(p.getAttribute('value'))", "5");
+shouldBe("parseInt(p.getAttribute('max'))", "10");
+
+debug("Set attributes to invalid values");
+p.setAttribute("value", "ABC");
+p.setAttribute("max", "#");
+shouldBe("p.value", "0");
+shouldBe("p.max", "1");
+shouldBe("p.getAttribute('value')", "'ABC'");
+shouldBe("p.getAttribute('max')", "'#'");
+
+debug("Set value and max to numbers with leading spaces");
+p.setAttribute("value", " 5");
+p.setAttribute("max", " 10");
+shouldBe("p.value", "0");
+shouldBe("p.max", "1");
+shouldBe("p.position", "0");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698