Bug 1527281 [wpt PR 15337] - decimal points in numbers, a=testonly
☠☠ backed out by 749b314d6c28 ☠ ☠
authorTab Atkins Jr <jackalmage@gmail.com>
Tue, 19 Feb 2019 14:39:27 +0000
changeset 460343 e8c23fbb5c1ad3219e365916bf9e3ee5c95e7548
parent 460342 28d2c5bcd984b2339b839f48cc586a1b1ede8ee0
child 460344 8de204a8ad00b24aff20a74e6faeb01da84c92cf
push id112074
push userwptsync@mozilla.com
push dateThu, 21 Feb 2019 19:59:15 +0000
treeherdermozilla-inbound@a15983fcecca [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>