Bug 1529734 [wpt PR 15401] - Added 1 test about z-index and fractional values, a=testonly
authorGérard Talbot <github@gtalbot.org>
Tue, 05 Mar 2019 12:18:41 +0000
changeset 464584 fc797e4666ff
parent 464583 8566ae4d1526
child 464585 070850f781ae
push id35717
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:45:26 +0000
treeherdermozilla-central@e0861be8d6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1529734, 15401
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 1529734 [wpt PR 15401] - Added 1 test about z-index and fractional values, a=testonly Automatic update from web-platform-tests Added 1 test about z-index and fractional values -- useless change to trigger a rebuild make sure to squash before merging -- wpt-commits: 6d6e82c1e7ad2632f91b167fc286000f50e0ad95, 88615a15e4acdb02646750dcdf3f1606ecbcf1b8 wpt-pr: 15401
testing/web-platform/tests/css/css-values/calc-z-index-fractions-001.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/calc-z-index-fractions-001.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+
+  <meta charset="UTF-8">
+
+  <title>CSS Values and Units Test: computed value of 'z-index' when specified with calc() function and fractional values</title>
+
+  <link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+  <link rel="help" href="https://www.w3.org/TR/css-values-4/#calc-range">
+
+  <meta name="flags" content="">
+  <meta content="This test verifies how 2 calc() functions are computed for 'z-index' when involved expressions end up being numbers halfway between adjacent integers." name="assert">
+
+  <script src="/resources/testharness.js"></script>
+
+  <script src="/resources/testharnessreport.js"></script>
+
+  <div id="target"></div>
+
+  <script>
+  function startTesting()
+  {
+
+  var targetElement = document.getElementById("target");
+
+    function verifyComputedStyle(property_name, initial_value, specified_value, expected_value, description)
+    {
+
+    test(function()
+      {
+
+      targetElement.style.setProperty(property_name, initial_value);
+
+      /*
+      The purpose of the initial_value is to act as a fallback
+      value in case the calc() function in the specified value
+      fails or in case it generates an invalid value. Since we
+      are running 2 consecutive tests on the same element,
+      then it is necessary to reset its property to an initial
+      value.
+      */
+
+      targetElement.style.setProperty(property_name, specified_value);
+
+      assert_equals(getComputedStyle(targetElement)[property_name], expected_value);
+
+      }, description);
+    }
+
+ /* verifyComputedStyle(property_name, initial_value, specified_value, expected_value, description) */
+
+    verifyComputedStyle("z-index", "auto", "calc(3 / 2)", "2", "testing z-index: calc(3 / 2)");
+
+    verifyComputedStyle("z-index", "auto", "calc(-3 / 2)", "-1", "testing z-index: calc(-3 / 2)");
+
+  }
+
+  startTesting();
+
+  </script>