Skip to content

Commit

Permalink
style: Test for calc integer expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Mar 27, 2017
1 parent c7ce2ff commit 3ab6a20
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -11057,6 +11057,12 @@
{}
]
],
"css/calc-number-serialization.html": [
[
"/_mozilla/css/calc-number-serialization.html",
{}
]
],
"css/empty-keyframes.html": [
[
"/_mozilla/css/empty-keyframes.html",
Expand Down Expand Up @@ -20700,6 +20706,10 @@
"94dc4aac4c546a74add074be0d3e604c8b196888",
"reftest"
],
"css/calc-number-serialization.html": [
"b9e77c824d0c96e51d51fb8f1e923d3ab67be027",
"testharness"
],
"css/canvas_as_block_element_a.html": [
"668d93da2dab9722998cc7c5785c20e2ab9a1ced",
"reftest"
Expand Down
18 changes: 18 additions & 0 deletions tests/wpt/mozilla/tests/css/calc-number-serialization.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS test: Calc expressions with numbers should still serialize as calc()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="test"></div>
<script>
var div = document.querySelector('#test');
test(function() {
div.style.lineHeight = "calc(1)";
assert_equals(div.style.lineHeight, "calc(1)");
}, "calc of an integer expression should be preserved");

test(function() {
div.style.lineHeight = "calc(1 + 3)";
assert_equals(div.style.lineHeight, "calc(4)");
}, "expressions on calc() should be simplified");
</script>

0 comments on commit 3ab6a20

Please sign in to comment.