blob: d88284e620db45a92c148d5c612018da26d41497 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Tests that the border-radius shorthand is computed properly.")
var testContainer = document.createElement("div");
testContainer.contentEditable = true;
document.body.appendChild(testContainer);
testContainer.innerHTML = '<div style="width:100px;height:100px"><div id="test">hello</div></div>';
e = document.getElementById('test');
computedStyle = window.getComputedStyle(e, null);
e.style.borderRadius = "4em";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'64px'");
e.style.borderRadius = "2em 1em 4em / 0.5em 3em";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'32px 16px 64px / 8px 48px'");
e.style.borderRadius = "";
e.style.borderTopLeftRadius = "4em";
e.style.borderTopRightRadius = "4em";
e.style.borderBottomLeftRadius = "4em";
e.style.borderBottomRightRadius = "4em";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'64px'");
e.style.borderRadius = "1px 2px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px'");
e.style.borderRadius = "1px 2px 4px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px 4px'");
e.style.borderRadius = "1px 2px 4px 6px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px 4px 6px'");
e.style.borderRadius = "1px 2px 4px 6px / 4em";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px 4px 6px / 64px'");
e.style.borderRadius = "1px 2px 4px 6px / 4em 3px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px 4px 6px / 64px 3px'");
e.style.borderRadius = "1px 2px 4px 6px / 4em 3px 7px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px 4px 6px / 64px 3px 7px'");
e.style.borderRadius = "1px 2px 4px 6px / 4em 3px 7px 8px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'1px 2px 4px 6px / 64px 3px 7px 8px'");
e.style.borderRadius = "10px 20px 30px 40px / 15px 25px 35px 45px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'10px 20px 30px 40px / 15px 25px 35px 45px'");
e.style.borderRadius = "10px 20px 30px 40px / 10px 25px 35px 45px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'10px 20px 30px 40px / 10px 25px 35px 45px'");
e.style.borderRadius = "10px 20px 30px 40px / 10px 20px 35px 45px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'10px 20px 30px 40px / 10px 20px 35px 45px'");
e.style.borderRadius = "10px 20px 30px 40px / 10px 20px 30px 45px";
shouldBe("computedStyle.getPropertyValue('border-radius')", "'10px 20px 30px 40px / 10px 20px 30px 45px'");
document.body.removeChild(testContainer);
</script>
</body>
</html>