Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-values/getComputedStyle-border-radius-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Values Test: mixed units in calc() and computed border-radius longhand and shorthand values (complex)</title>
<!--
Original test is:
-->
<link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div#target
{
border: solid 2px;
border-top-left-radius: calc(10px + 25%) calc(20px + 25%);
border-top-right-radius: calc(1em + 25%);
border-bottom-right-radius: calc(25%);
border-bottom-left-radius: calc(25px);
font-size: 16px; /* was 10px in original test */
height: 100px;
width: 100px;
}
</style>
<div id="target"></div>
<script>
function startTesting()
{
var targetElement = document.getElementById("target");
function verifyComputedStyle(property_name, expected_value)
{
test(function()
{
assert_equals(getComputedStyle(targetElement)[property_name], expected_value);
}, `testing ${property_name}: ${expected_value}`);
}
/* verifyComputedStyle(property_name, expected_value) */
verifyComputedStyle("border-top-left-radius", "calc(25% + 10px) calc(25% + 20px)");
verifyComputedStyle("border-top-right-radius", "calc(25% + 16px)");
verifyComputedStyle("border-bottom-right-radius", "25%");
verifyComputedStyle("border-bottom-left-radius", "25px");
verifyComputedStyle("border-radius", "calc(25% + 10px) calc(25% + 16px) 25% 25px / calc(25% + 20px) calc(25% + 16px) 25% 25px");
/*
The first value is the horizontal radius, the second the vertical radius.
horizontal radius / vertical radius
|__________________________________________| |__________________________________________|
The four values for each radii are given in the order top-left, top-right, bottom-right, bottom-left:
top-left top-right bottom-right bottom-left / top-left top-right bottom-right bottom-left
|__________________________________________| |__________________________________________|
horizontal radius / vertical radius
*/
}
startTesting();
</script>