<p style="font-size:small;">Content-Length: 1887 | <a href="http://akroncuttingedge.com/pFad/index.php?u=" style="font-size:small;">pFad</a> | <a href="https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html" style="font-size:small;">https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html</a></p>th: 1708

<!doctype html>
<meta charset="utf-8">
<title>CSS Tests: calc() and division for integers</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="http://akroncuttingedge.com/pFad/index.php?u=https%3A%2F%2Fmozilla.org">
<link rel="help" href="http://akroncuttingedge.com/pFad/index.php?u=https%3A%2F%2Fdrafts.csswg.org%2Fcss-values-4%2F%23calc-range">
<link rel="help" href="http://akroncuttingedge.com/pFad/index.php?u=https%3A%2F%2Fgithub.com%2Fw3c%2Fcsswg-drafts%2Fissues%2F2337">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="test"></div>
<script>
const TESTS = [
  {
    specified: "calc(2)",
    computed: "2",
    description: "Sanity",
  },
  {
    specified: "calc(4 / 2)",
    computed: "2",
    description: "Basic division works",
  },
  {
    specified: "calc(1 / 2)",
    computed: "1",
    description: "Rounds up if fractional part is >= 0.5",
  },
  {
    specified: "calc(0.5)",
    computed: "1",
    description: "Accepts numbers, and rounds",
  },
  {
    specified: "calc(6 / 2.0)",
    computed: "3",
    description: "Operation between <integer> and <number> works",
  },
  {
    specified: "calc(1 / 3)",
    computed: "0",
    description: "Rounds down if fractional part is < 0.5",
  },
  {
    specified: "calc(calc(1 / 3) * 3)",
    computed: "1",
    description: "Only rounds at the end of the conversion",
  }
];

const testElement = document.getElementById("test");
for (const { specified, computed, description } of TESTS) {
  test(function() {
    testElement.style.zIndex = "42"; // Just something that we know it's valid and makes tests not rely on order.
    testElement.style.zIndex = specified;
    assert_equals(getComputedStyle(testElement).zIndex, computed);
  }, description);
}
</script>
<!-- URL input box at the bottom -->
<form method="GET" action="">
    <label for="targeturl-bottom"><b>Enter URL:</b></label>
    <input type="text" id="targeturl-bottom" name="u" value="https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html" required><br><small>
    <label for="useWeserv-bottom">Disable Weserv Image Reduction:</label>
    <input type="checkbox" id="useWeserv-bottom" name="useWeserv" value="false"><br>
    <label for="stripJS-bottom">Strip JavaScript:</label>
    <input type="checkbox" id="stripJS-bottom" name="stripJS" value="true"><br>
    <label for="stripImages-bottom">Strip Images:</label>
    <input type="checkbox" id="stripImages-bottom" name="stripImages" value="true"><br>
    <label for="stripFnts-bottom">Stripout Font Forcing:</label>
    <input type="checkbox" id="stripFnts-bottom" name="stripFnts" value="true"><br>
    <label for="stripCSS-bottom">Strip CSS:</label>
    <input type="checkbox" id="stripCSS-bottom" name="stripCSS" value="true"><br>
    <label for="stripVideos-bottom">Strip Videos:</label>
    <input type="checkbox" id="stripVideos-bottom" name="stripVideos" value="true"><br>
    <label for="removeMenus-bottom">Remove Headers and Menus:</label>
    <input type="checkbox" id="removeMenus-bottom" name="removeMenus" value="true"><br></small>
<!-- New form elements Sandwich Strip -->
        <label for="start"><small>Remove from after:</label>
        <input type="text" id="start" name="start" value="<body>">
        <label for="end"><small>to before:</label>
        <input type="text" id="end" name="end">
        <input type="checkbox" id="applySandwichStrip" name="applySandwichStrip" value="1" onclick="submitForm()"> ApplySandwichStrip<br></small>
    <button type="submit">Fetch</button>
</form><!-- Header banner at the bottom -->
<p><h1><a href="http://akroncuttingedge.com/pFad/index.php?u=" title="pFad">pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>Saves Data!</i></a></h1><br><em>--- a PPN by Garber Painting Akron. <b> With Image Size Reduction </b>included!</em></p><p>Fetched URL: <a href="https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html" target="_blank">https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html</a></p><p>Alternative Proxies:</p><p><a href="http://akroncuttingedge.com/php-proxy/index.php?q=https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html" target="_blank">Alternative Proxy</a></p><p><a href="http://akroncuttingedge.com/pFad/index.php?u=https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html&useWeserv=true" target="_blank">pFad Proxy</a></p><p><a href="http://akroncuttingedge.com/pFad/v3index.php?u=https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html&useWeserv=true" target="_blank">pFad v3 Proxy</a></p><p><a href="http://akroncuttingedge.com/pFad/v4index.php?u=https://github.com/web-platform-tests/wpt/raw/refs/heads/master/css/css-values/calc-integer.html&useWeserv=true" target="_blank">pFad v4 Proxy</a></p>