chromium/third_party/blink/web_tests/fast/css/default-bidi-css-rules.html

<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<p>This test checks <a href="http://dev.w3.org/html5/spec/Overview.html#bidirectional-text">the default rules for direction and unicode-bidi CSS properties</a>.</p>
<div id="container"></div>
<div id="console"></div>
<script>

var container = document.getElementById('container');

function styleOf(name, attributes) {
    var element = document.createElement(name);
    for (var name in attributes) {
        var value = attributes[name];
        element.setAttribute(name, value);
    }
    container.appendChild(element);
    return getComputedStyle(element);
}

var tests = [
    ['div', {}, 'ltr', 'isolate'],
    ['div', {'dir': 'ltr'}, 'ltr', 'isolate'],
    ['div', {'dir': 'rtl'}, 'rtl', 'isolate'],
    ['div', {'dir': 'auto'}, 'ltr', 'isolate'],
    ['div', {'dir': ''}, 'ltr', 'isolate'],

    ['span', {}, 'ltr', 'normal'],
    ['span', {'dir': 'ltr'}, 'ltr', 'isolate'],
    ['span', {'dir': 'rtl'}, 'rtl', 'isolate'],
    ['span', {'dir': 'auto'}, 'ltr', 'isolate'],
    ['span', {'dir': ''}, 'ltr', 'normal'],

    ['bdi', {}, 'ltr', 'isolate'],
    ['bdi', {'dir': 'ltr'}, 'ltr', 'isolate'],
    ['bdi', {'dir': 'rtl'}, 'rtl', 'isolate'],
    ['bdi', {'dir': 'auto'}, 'ltr', 'isolate'],
    ['bdi', {'dir': ''}, 'ltr', 'isolate'],

    ['output', {}, 'ltr', 'isolate'],
    ['output', {'dir': 'ltr'}, 'ltr', 'isolate'],
    ['output', {'dir': 'rtl'}, 'rtl', 'isolate'],
    ['output', {'dir': 'auto'}, 'ltr', 'isolate'],
    ['output', {'dir': ''}, 'ltr', 'isolate'],

    // https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering
    ['bdo', {}, 'ltr', 'isolate-override'],
    ['bdo', {'dir': 'ltr'}, 'ltr', 'isolate-override'],
    ['bdo', {'dir': 'rtl'}, 'rtl', 'isolate-override'],
    ['bdo', {'dir': 'auto'}, 'ltr', 'isolate-override'],
    ['bdo', {'dir': ''}, 'ltr', 'isolate-override'],

    ['textarea', {}, 'ltr', 'normal'],
    ['textarea', {'dir': 'ltr'}, 'ltr', 'isolate'],
    ['textarea', {'dir': 'rtl'}, 'rtl', 'isolate'],
    ['textarea', {'dir': 'auto'}, 'ltr', 'plaintext'],
    ['textarea', {'dir': ''}, 'ltr', 'normal'],

    ['pre', {}, 'ltr', 'isolate'],
    ['pre', {'dir': 'ltr'}, 'ltr', 'isolate'],
    ['pre', {'dir': 'rtl'}, 'rtl', 'isolate'],
    ['pre', {'dir': 'auto'}, 'ltr', 'plaintext'],
    ['pre', {'dir': ''}, 'ltr', 'isolate'],
].forEach(function (test) {
    shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').direction', '"' + test[2] + '"');
    container.innerHTML = '';
    shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').unicodeBidi', '"' + test[3] + '"');
    container.innerHTML = '';
});

</script>
</body>
</html>