Bug 1527281 [wpt PR 15337] - decimal points in numbers, a=testonly
authorTab Atkins Jr <jackalmage@gmail.com>
Tue, 19 Feb 2019 14:39:27 +0000
changeset 519249 d20202f2766ffb670cc9e55d0a1a17d4813b5925
parent 519248 1e911c6dccff3a91a6cc75f09d1d11d47a1ef2a4
child 519250 4fce8beb3c9e5c1ff467c988cdc2cf379d99355c
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1527281, 15337
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1527281 [wpt PR 15337] - decimal points in numbers, a=testonly Automatic update from web-platform-tests decimal points in numbers Tests that decimal points are allowed *before* digits (like `.1`) and *between* digits (like `0.1`), but not *after* digits (like `1.`). Tests <https://github.com/w3c/csswg-drafts/issues/3599> -- fix whitespace for lint -- Name all tests uniquely -- Merge pull request #15337 from web-platform-tests/tabatkins-patch-2 decimal points in numbers -- wpt-commits: 5fdd036dbd18fa6d2e7cf235bd9acc625a6df22e, f17e215eaa37316f1489a7b62ab103d2a58a0d89, 31e1a1bb5fadb08749e4b8070ad0f19ec5ea1088, e2eb25aaa6dd3c512b172588f3400f9c25a410c3 wpt-pr: 15337
testing/web-platform/tests/css/css-syntax/decimal-points-in-numbers.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-syntax/decimal-points-in-numbers.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<title>decimal points in numbers</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<meta name=author title="Tab Atkins-Bittner">
+<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-number">
+
+<style>
+
+.foo {}
+
+</style>
+<script>
+
+function roundTripNumber(input) {
+    const rule = document.styleSheets[0].cssRules[0].style;
+    const fallback = "0";
+    rule.setProperty("line-height", fallback);
+    rule.setProperty("line-height", input);
+    const value = rule.getPropertyValue("line-height");
+    if(value == fallback) return false;
+    return value;
+}
+
+test(()=>{
+    assert_equals(roundTripNumber("1.0"), "1");
+}, "decimal point between digits is valid in a number");
+test(()=>{
+    assert_equals(roundTripNumber(".1"), "0.1");
+}, "decimal point before digits is valid in a number");
+test(()=>{
+    assert_not_equals(roundTripNumber("1."), "1");
+}, "decimal point after digits is invalid in a number");
+
+function roundTripDimension(input) {
+    const rule = document.styleSheets[0].cssRules[0].style;
+    const fallback = "0px";
+    rule.setProperty("width", fallback);
+    rule.setProperty("width", input);
+    const value = rule.getPropertyValue("width");
+    if(value == fallback) return false;
+    return value;
+}
+
+test(()=>{
+    assert_equals(roundTripDimension("1.0px"), "1px");
+}, "decimal point between digits is valid in a dimension");
+test(()=>{
+    assert_equals(roundTripDimension(".1px"), "0.1px");
+}, "decimal point before digits is valid in a dimension");
+test(()=>{
+    assert_not_equals(roundTripDimension("1.px"), "1px");
+}, "decimal point after digits is invalid in a dimension");
+
+</script>