calc-serialization.html (1056B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Values and Units: calc() serialization.</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@mozilla.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-values/#calc-serialize"> 6 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/1731"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <div id="content"></div> 10 <script> 11 test(function() { 12 // specified -> expected 13 var values = { 14 "calc(10px + 1vmin + 10%)": "calc(10% + 10px + 1vmin)", 15 "calc(10px + 1vmin)": "calc(10px + 1vmin)", 16 "calc(10px + 1em)": "calc(1em + 10px)", 17 "calc(1vmin - 10px)": "calc(-10px + 1vmin)", 18 "calc(-10px + 1em)": "calc(1em - 10px)", 19 "calc(-10px)": "calc(-10px)", 20 }; 21 22 var content = document.getElementById("content"); 23 24 for (var prop in values) { 25 content.style.width = prop; 26 assert_equals(content.style.width, values[prop], "Serialization of " + prop); 27 } 28 }, "calc() serialization") 29 </script>