chromium/third_party/blink/web_tests/fast/dom/HTMLElement/attr-dir-auto.html

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../../../resources/js-test.js"></script>
<style>
.testDiv {border-inline-start: 5px solid green; border-inline-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.
<div id="left-to-right" dir="auto" class="testDiv">Test test test</div>
Test that the direction of hebrew text is right-to-left.
<div id="right-to-left1" dir="auto" class="testDiv">מקור השם עברית</div>
Test that '?' does not affect the directionality.
<div id="right-to-left2" dir="auto" class="testDiv"><span>??</span>מקור השם עברית<span>??</span></div>
</div>
<script>

description('Test that directionality of an element with dir=auto set is determined by the first child text node of that element.');

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)'");
document.getElementById("parentDiv").style.display = "none";
</script>
</body>
</html>