OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <p>This test checks <a href="http://dev.w3.org/html5/spec/Overview.html#bidirect
ional-text">the default rules for direction and unicode-bidi CSS properties</a>.
</p> | 5 <p>This test checks <a href="http://dev.w3.org/html5/spec/Overview.html#bidirect
ional-text">the default rules for direction and unicode-bidi CSS properties</a>.
</p> |
6 <div id="container"></div> | 6 <div id="container"></div> |
7 <div id="console"></div> | 7 <div id="console"></div> |
8 <script> | 8 <script> |
9 | 9 |
10 var container = document.getElementById('container'); | 10 var container = document.getElementById('container'); |
11 | 11 |
12 function styleOf(name, attributes) { | 12 function styleOf(name, attributes) { |
13 var element = document.createElement(name); | 13 var element = document.createElement(name); |
14 for (var name in attributes) { | 14 for (var name in attributes) { |
15 var value = attributes[name]; | 15 var value = attributes[name]; |
16 element.setAttribute(name, value); | 16 element.setAttribute(name, value); |
17 } | 17 } |
18 container.appendChild(element); | 18 container.appendChild(element); |
19 return getComputedStyle(element); | 19 return getComputedStyle(element); |
20 } | 20 } |
21 | 21 |
22 var tests = [ | 22 var tests = [ |
23 ['div', {}, 'ltr', '-webkit-isolate'], | 23 ['div', {}, 'ltr', '-webkit-isolate'], |
24 ['div', {'dir': 'ltr'}, 'ltr', 'embed'], | 24 ['div', {'dir': 'ltr'}, 'ltr', 'isolate'], |
25 ['div', {'dir': 'rtl'}, 'rtl', 'embed'], | 25 ['div', {'dir': 'rtl'}, 'rtl', 'isolate'], |
26 ['div', {'dir': 'auto'}, 'ltr', 'isolate'], | 26 ['div', {'dir': 'auto'}, 'ltr', 'isolate'], |
27 ['div', {'dir': ''}, 'ltr', 'embed'], | 27 ['div', {'dir': ''}, 'ltr', 'isolate'], |
28 | 28 |
29 ['span', {}, 'ltr', 'normal'], | 29 ['span', {}, 'ltr', 'normal'], |
30 ['span', {'dir': 'ltr'}, 'ltr', 'embed'], | 30 ['span', {'dir': 'ltr'}, 'ltr', 'isolate'], |
31 ['span', {'dir': 'rtl'}, 'rtl', 'embed'], | 31 ['span', {'dir': 'rtl'}, 'rtl', 'isolate'], |
32 ['span', {'dir': 'auto'}, 'ltr', 'isolate'], | 32 ['span', {'dir': 'auto'}, 'ltr', 'isolate'], |
33 ['span', {'dir': ''}, 'ltr', 'embed'], | 33 ['span', {'dir': ''}, 'ltr', 'isolate'], |
34 | 34 |
35 ['bdi', {}, 'ltr', 'isolate'], | 35 ['bdi', {}, 'ltr', 'isolate'], |
36 ['bdi', {'dir': 'ltr'}, 'ltr', 'isolate'], | 36 ['bdi', {'dir': 'ltr'}, 'ltr', 'isolate'], |
37 ['bdi', {'dir': 'rtl'}, 'rtl', 'isolate'], | 37 ['bdi', {'dir': 'rtl'}, 'rtl', 'isolate'], |
38 ['bdi', {'dir': 'auto'}, 'ltr', 'isolate'], | 38 ['bdi', {'dir': 'auto'}, 'ltr', 'isolate'], |
39 ['bdi', {'dir': ''}, 'ltr', 'isolate'], | 39 ['bdi', {'dir': ''}, 'ltr', 'isolate'], |
40 | 40 |
41 ['output', {}, 'ltr', 'isolate'], | 41 ['output', {}, 'ltr', 'isolate'], |
42 ['output', {'dir': 'ltr'}, 'ltr', 'isolate'], | 42 ['output', {'dir': 'ltr'}, 'ltr', 'isolate'], |
43 ['output', {'dir': 'rtl'}, 'rtl', 'isolate'], | 43 ['output', {'dir': 'rtl'}, 'rtl', 'isolate'], |
44 ['output', {'dir': 'auto'}, 'ltr', 'isolate'], | 44 ['output', {'dir': 'auto'}, 'ltr', 'isolate'], |
45 ['output', {'dir': ''}, 'ltr', 'isolate'], | 45 ['output', {'dir': ''}, 'ltr', 'isolate'], |
46 | 46 |
47 ['bdo', {}, 'ltr', 'bidi-override'], | 47 ['bdo', {}, 'ltr', 'bidi-override'], |
48 ['bdo', {'dir': 'ltr'}, 'ltr', 'bidi-override'], | 48 ['bdo', {'dir': 'ltr'}, 'ltr', 'bidi-override'], |
49 ['bdo', {'dir': 'rtl'}, 'rtl', 'bidi-override'], | 49 ['bdo', {'dir': 'rtl'}, 'rtl', 'bidi-override'], |
50 ['bdo', {'dir': 'auto'}, 'ltr', 'bidi-override isolate'], | 50 ['bdo', {'dir': 'auto'}, 'ltr', 'bidi-override isolate'], |
51 ['bdo', {'dir': ''}, 'ltr', 'bidi-override'], | 51 ['bdo', {'dir': ''}, 'ltr', 'bidi-override'], |
52 | 52 |
53 ['textarea', {}, 'ltr', 'normal'], | 53 ['textarea', {}, 'ltr', 'normal'], |
54 ['textarea', {'dir': 'ltr'}, 'ltr', 'embed'], | 54 ['textarea', {'dir': 'ltr'}, 'ltr', 'isolate'], |
55 ['textarea', {'dir': 'rtl'}, 'rtl', 'embed'], | 55 ['textarea', {'dir': 'rtl'}, 'rtl', 'isolate'], |
56 ['textarea', {'dir': 'auto'}, 'ltr', 'plaintext'], | 56 ['textarea', {'dir': 'auto'}, 'ltr', 'plaintext'], |
57 ['textarea', {'dir': ''}, 'ltr', 'embed'], | 57 ['textarea', {'dir': ''}, 'ltr', 'isolate'], |
58 | 58 |
59 ['pre', {}, 'ltr', 'normal'], | 59 ['pre', {}, 'ltr', 'normal'], |
60 ['pre', {'dir': 'ltr'}, 'ltr', 'embed'], | 60 ['pre', {'dir': 'ltr'}, 'ltr', 'isolate'], |
61 ['pre', {'dir': 'rtl'}, 'rtl', 'embed'], | 61 ['pre', {'dir': 'rtl'}, 'rtl', 'isolate'], |
62 ['pre', {'dir': 'auto'}, 'ltr', 'plaintext'], | 62 ['pre', {'dir': 'auto'}, 'ltr', 'plaintext'], |
63 ['pre', {'dir': ''}, 'ltr', 'embed'], | 63 ['pre', {'dir': ''}, 'ltr', 'isolate'], |
64 ].forEach(function (test) { | 64 ].forEach(function (test) { |
65 shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').direct
ion', '"' + test[2] + '"'); | 65 shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').direct
ion', '"' + test[2] + '"'); |
66 container.innerHTML = ''; | 66 container.innerHTML = ''; |
67 shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').unicod
eBidi', '"' + test[3] + '"'); | 67 shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').unicod
eBidi', '"' + test[3] + '"'); |
68 container.innerHTML = ''; | 68 container.innerHTML = ''; |
69 }); | 69 }); |
70 | 70 |
71 </script> | 71 </script> |
72 </body> | 72 </body> |
73 </html> | 73 </html> |
OLD | NEW |