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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLMeterElement/set-meter-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/HTMLMeterElement/set-meter-properties.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html
index a9e3ca1572144050b81eed9c7f7605ecd0bc7dbe..2bbdbb54be961aa5b46200dc93d4562e2b4e0ba3 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html
@@ -4,6 +4,134 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/set-meter-properties.js"></script>
+<script>
+description('Test setting valid and invalid properties of HTMLMeterElement.');
+
+var m = document.createElement('meter');
+
+debug("Test values before properties were set");
+shouldBe("m.min", "0");
+shouldBe("m.value", "0");
+shouldBe("m.max", "1");
+shouldBe("m.low", "0");
+shouldBe("m.high", "1");
+shouldBe("m.optimum", "0.5");
+
+debug("Set valid values");
+m.min = "-10";
+m.value = 7e1;
+m.max = "1e2";
+m.low = "10.1";
+m.high = "99.5";
+m.optimum = "70";
+shouldBe("m.min", "-10");
+shouldBe("m.value", "70");
+shouldBe("m.max", "100");
+shouldBe("m.low", "10.1");
+shouldBe("m.high", "99.5");
+shouldBe("m.optimum", "70");
+
+debug("Set attributes to improper values - 1");
+m.min = -10;
+m.value = 200;
+m.max = 100.0;
+m.low = 200;
+m.high = -50;
+m.optimum = null;
+shouldBe("m.min", "-10");
+shouldBe("m.value", "100");
+shouldBe("m.max", "100");
+shouldBe("m.low", "100");
+shouldBe("m.high", "100");
+shouldBe("m.optimum", "0");
+
+debug("Set attributes to improper values - 2");
+m.min = 200.0;
+m.value = -200.0;
+m.max = 0;
+m.low = null;
+shouldBe("m.min", "200.0");
+shouldBe("m.value", "200.0");
+shouldBe("m.max", "200.0");
+shouldBe("m.low", "200.0");
+
+debug("Set attributes to improper values - 3");
+m.min = 100.0;
+m.value = 200.0;
+m.max = 50;
+m.low = 10;
+m.high = 15e1;
+m.optimum = 12.5;
+shouldBe("m.min", "100.0");
+shouldBe("m.value", "100.0");
+shouldBe("m.max", "100.0");
+shouldBe("m.low", "100.0");
+shouldBe("m.high", "100.0");
+shouldBe("m.optimum", "100.0");
+
+debug("Set attributes to improper values - 4");
+m.min = 0.0;
+m.value = 250.0;
+m.max = 200;
+m.low = -10;
+m.high = 15e2;
+m.optimum = 12.5;
+shouldBe("m.min", "0.0");
+shouldBe("m.value", "200.0");
+shouldBe("m.max", "200.0");
+shouldBe("m.low", "0.0");
+shouldBe("m.high", "200.0");
+shouldBe("m.optimum", "12.5");
+
+debug("Set value to invalid value");
+shouldThrow('m.value = "value";');
+
+debug("Set min to NaN");
+shouldThrow('m.min = NaN;');
+
+debug("Set max to Infinity");
+shouldThrow('m.max = Infinity;');
+
+debug("Set low to invalid value");
+shouldThrow('m.low = "low";');
+
+debug("Set high to NaN");
+shouldThrow('m.high = NaN;');
+
+debug("Set optimum to Infinity");
+shouldThrow('m.optimum = Infinity;');
+
+debug("Set attributes to valid numbers");
+m.setAttribute("min", 0);
+m.setAttribute("value", 5);
+m.setAttribute("max", 10);
+shouldBe("m.value", "5");
+shouldBe("m.max", "10");
+shouldBe("parseInt(m.getAttribute('value'))", "5");
+shouldBe("parseInt(m.getAttribute('max'))", "10");
+
+debug("Set attributes to invalid values");
+m.setAttribute("value", "ABC");
+m.setAttribute("max", "#");
+shouldBe("m.value", "0");
+shouldBe("m.max", "1");
+shouldBe("m.getAttribute('value')", "'ABC'");
+shouldBe("m.getAttribute('max')", "'#'");
+
+debug("Set attributes to numbers with leading spaces");
+m.setAttribute("value", " 5");
+m.setAttribute("min", " 5");
+m.setAttribute("max", " 5");
+m.setAttribute("low", " 5");
+m.setAttribute("high", " 5");
+m.setAttribute("optimum", " 5");
+shouldBe("m.value", "0");
+shouldBe("m.min", "0");
+shouldBe("m.max", "1");
+shouldBe("m.low", "0");
+shouldBe("m.high", "1");
+shouldBe("m.optimum", "0.5");
+
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698