gecko-dev/testing/web-platform/tests/css/css-values/calc-z-index-fractions-001.html
Gérard Talbot e945fed0d4 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
2019-03-16 12:12:58 +00:00

59 lines
1.9 KiB
HTML

<!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>