blob: ab701a0f3813ffe2597be071024866551acfea79 [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>
.testElement {-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">
Test that the direction of english text is left-to-right in the text form control.
<input type="text" id="left-to-right" dir="auto" class="testElement" value="Test test test">
Test that the direction of hebrew text is right-to-left in the text form control.
<input type="text" id="right-to-left1" dir="auto" class="testElement" value="מקור השם עברית">
<textarea id="right-to-left2" dir="auto" class="testElement">מקור השם עברית</textarea>
Test that the direction of hebrew text is right-to-left in the text form control, even if inserted dynamically.
<textarea id="right-to-left3" dir="auto" class="testElement"></textarea>
</div>
<script>
description('Test that directionality of a text form control with dir=auto set is determined by the value of that form control.');
var el = document.getElementById("left-to-right");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
el = document.getElementById("right-to-left1");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
el = document.getElementById("right-to-left2");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
el = document.getElementById("right-to-left3");
el.innerText = "מקור השם עברית";
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
document.getElementById("parentDiv").style.display = "none";
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>