blob: 9b85d17a1c69241c5159956eb98bef7d9be277a5 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test to make sure -webkit-column-rule property returns CSSValueList properly.")
var testContainer = document.createElement("div");
testContainer.contentEditable = true;
document.body.appendChild(testContainer);
testContainer.innerHTML = '<div id="test" style="-webkit-column-rule: thin dotted black;">hello</div>';
e = document.getElementById('test');
computedStyle = window.getComputedStyle(e, null);
shouldBeEqualToString("computedStyle.getPropertyValue('-webkit-column-rule')", '1px dotted rgb(0, 0, 0)');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').toString()", '[object CSSValueList]');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').cssText", '1px dotted rgb(0, 0, 0)');
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').length", "3");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "1");
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(1).getStringValue()", "dotted");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
e.style.webkitColumnRule="10px red";
shouldBeEqualToString("computedStyle.getPropertyValue('-webkit-column-rule')", '0px none rgb(255, 0, 0)');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').toString()", '[object CSSValueList]');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').cssText", '0px none rgb(255, 0, 0)');
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').length", "3");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(1).getStringValue()", "none");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
e.style.webkitColumnRuleWidth="medium"
e.style.webkitColumnRuleStyle="dashed"
shouldBeEqualToString("computedStyle.getPropertyValue('-webkit-column-rule')", '3px dashed rgb(255, 0, 0)');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').toString()", '[object CSSValueList]');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').cssText", '3px dashed rgb(255, 0, 0)');
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').length", "3");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "3");
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(1).getStringValue()", "dashed");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
e.style.webkitColumnRule="10px dotted blue"
e.style.webkitColumnRuleStyle="none";
shouldBeEqualToString("computedStyle.getPropertyValue('-webkit-column-rule')", '0px none rgb(0, 0, 255)');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').toString()", '[object CSSValueList]');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').cssText", '0px none rgb(0, 0, 255)');
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').length", "3");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(1).getStringValue()", "none");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
e.style.webkitColumnRuleStyle="hidden";
shouldBeEqualToString("computedStyle.getPropertyValue('-webkit-column-rule')", '0px hidden rgb(0, 0, 255)');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').toString()", '[object CSSValueList]');
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').cssText", '0px hidden rgb(0, 0, 255)');
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').length", "3");
shouldBe("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
shouldBeEqualToString("computedStyle.getPropertyCSSValue('-webkit-column-rule').item(1).getStringValue()", "hidden");
document.body.removeChild(testContainer);
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>