blob: 82ddbfe9c45911408edaad76913240d4a51b4822 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../../../resources/js-test-pre.js"></script>
<style>
.testDiv {-webkit-border-start: 5px solid green; -webkit-border-end: 5px solid red; }
</style>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="result"></div>
<div id="parentDiv">
<div id="parent1" dir="auto" class="testDiv">
<div id="child1">מקור השם עברית</div>
<div id="child2">Test</div>
</div>
<div id="parent2" dir="auto" class="testDiv">
<div id="child3">Test</div>
</div>
<div id="parent3" class="testDiv">
<div id="child4">מקור השם עברית</div>
</div>
</div>
<script>
description('Test that directionality of an element with dir=auto set is re-evaluated when the first child text node of that element is added or removed. Also test that directionality does not change if the element does not have the attribute dir=auto.');
var parent1 = document.getElementById("parent1");
var parent2 = document.getElementById("parent2");
var parent3 = document.getElementById("parent3");
var child1 = document.getElementById("child1");
var child3 = document.getElementById("child3");
var child4 = document.getElementById("child4");
shouldBe("document.defaultView.getComputedStyle(parent1, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
shouldBe("document.defaultView.getComputedStyle(parent2, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
shouldBe("document.defaultView.getComputedStyle(parent3, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
parent1.removeChild(child1)
shouldBe("document.defaultView.getComputedStyle(parent1, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
parent2.insertBefore(child1, child3);
shouldBe("document.defaultView.getComputedStyle(parent2, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
parent2.removeChild(child1)
shouldBe("document.defaultView.getComputedStyle(parent2, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
parent3.insertBefore(child1, child4);
shouldBe("document.defaultView.getComputedStyle(parent3, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
document.getElementById("parentDiv").style.display = "none";
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>