blob: cb0079fb4ba32deac324c79fa0f5e03a71d5c110 [file] [log] [blame]
<!DOCTYPE html>
<html>
<style>
* { font-size: 16px; }
svg, rect { font-family: 'Ahem'; }
div { font-size: 8px; }
</style>
<html>
<svg id="svg" width="0" height="0"></svg>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test that 'with' presentation attribute is parsed with CSS presentation rules.");
function computedStyle(property, value) {
var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
document.getElementById('svg').appendChild(rect);
rect.setAttribute(property, value);
var computedValue = getComputedStyle(rect).getPropertyValue(property);
document.getElementById('svg').removeChild(rect);
return computedValue;
}
function testComputed(property, value, expected) {
shouldBeEqualToString('computedStyle("' + property + '", "' + value + '")', expected);
}
function negativeTest(property, value) {
testComputed(property, value, "auto");
}
// test mask-image
testComputed("height", "auto", "auto");
testComputed("height", " 100", "100px");
testComputed("height", "100 ", "100px");
testComputed("height", "100px", "100px");
testComputed("height", "1em", "16px");
testComputed("height", "1ex", "12.8px");
testComputed("height", "20%", "20%");
// FIXME: Vieport units not implemented for SVG at the moment.
// testComputed("height", "1vh", "7.869999885559082px");
// testComputed("height", "1vw", "14.029999732971191px");
// negative tests
negativeTest("height", "100 px");
negativeTest("height", "100px;");
negativeTest("height", "100px !important");
negativeTest("height", "{ 100px }");
negativeTest("height", "-100px");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>