| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../resources/js-test-pre.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', 'embed'], |
| |
| ['span', {}, 'ltr', 'normal'], |
| ['span', {'dir': 'ltr'}, 'ltr', 'isolate'], |
| ['span', {'dir': 'rtl'}, 'rtl', 'isolate'], |
| ['span', {'dir': 'auto'}, 'ltr', 'isolate'], |
| ['span', {'dir': ''}, 'ltr', 'embed'], |
| |
| ['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'], |
| |
| ['bdo', {}, 'ltr', 'bidi-override'], |
| ['bdo', {'dir': 'ltr'}, 'ltr', 'bidi-override'], |
| ['bdo', {'dir': 'rtl'}, 'rtl', 'bidi-override'], |
| ['bdo', {'dir': 'auto'}, 'ltr', 'bidi-override isolate'], |
| ['bdo', {'dir': ''}, 'ltr', 'bidi-override'], |
| |
| ['textarea', {}, 'ltr', 'normal'], |
| ['textarea', {'dir': 'ltr'}, 'ltr', 'isolate'], |
| ['textarea', {'dir': 'rtl'}, 'rtl', 'isolate'], |
| ['textarea', {'dir': 'auto'}, 'ltr', 'plaintext'], |
| ['textarea', {'dir': ''}, 'ltr', 'embed'], |
| |
| ['pre', {}, 'ltr', 'normal'], |
| ['pre', {'dir': 'ltr'}, 'ltr', 'isolate'], |
| ['pre', {'dir': 'rtl'}, 'rtl', 'isolate'], |
| ['pre', {'dir': 'auto'}, 'ltr', 'plaintext'], |
| ['pre', {'dir': ''}, 'ltr', 'embed'], |
| ].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> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |