|
2 | 2 | <title>HTML Test: dir=auto|rtl with slots, and direction should be RTLtitle>
|
3 | 3 | <meta charset="UTF-8">
|
4 | 4 | <meta name=" author" title=" Miyoung Shin" href=" mailto:[email protected]" >
|
5 |
| -<meta name="assert" content="When dir='auto', the direction is set according to |
6 |
| - slot's assigned node. And the direction should be propagated to shadow" /> |
| 5 | +<meta name=" author" title=" L. David Baron" href=" mailto:[email protected]" > |
7 | 6 | <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-dir-attribute"/>
|
| 7 | +<link rel="help" href="https://github.com/whatwg/html/issues/3699"> |
8 | 8 | <script src="/resources/testharness.js">script>
|
9 | 9 | <script src="/resources/testharnessreport.js">script>
|
10 | 10 | <div id="host1"><span>span>div>
|
11 | 11 | <div id="host2" dir="rtl">div>
|
12 | 12 | <span id="host3" dir="auto">span>
|
13 | 13 | <div id="host4">اختبرdiv>
|
14 | 14 | <div id="host5">div>
|
| 15 | +<div id="host6">اختبرdiv> |
15 | 16 | <script>
|
16 |
| -let root1 = host1.attachShadow({mode:"open"}); |
17 |
| -root1.innerHTML = ''; |
18 | 17 |
|
19 |
| -let root2 = host2.attachShadow({mode:"open"}); |
20 |
| -root2.innerHTML = ''; |
| 18 | +test(() => { |
| 19 | + let root1 = host1.attachShadow({mode:"open"}); |
| 20 | + root1.innerHTML = ''; |
| 21 | + let span = host1.firstChild; |
| 22 | + assert_equals(getComputedStyle(span).direction, "rtl"); |
| 23 | + assert_true(span.matches(":dir(ltr)")); |
| 24 | +}, 'Slots: Directionality: dir=rtl on slot'); |
21 | 25 |
|
22 |
| -let root3 = host3.attachShadow({mode:"open"}); |
23 |
| -root3.innerHTML = `اختبر`; |
| 26 | +test(() => { |
| 27 | + let root2 = host2.attachShadow({mode:"open"}); |
| 28 | + root2.innerHTML = ''; |
| 29 | + let span = root2.querySelector("span"); |
| 30 | + assert_equals(getComputedStyle(span).direction, "rtl"); |
| 31 | + assert_true(span.matches(":dir(rtl)")); |
| 32 | +}, 'Slots: Directionality: dir=rtl on host'); |
24 | 33 |
|
25 |
| -let root4 = host4.attachShadow({mode:"open"}); |
26 |
| -root4.innerHTML = ''; |
| 34 | +test(() => { |
| 35 | + let root3 = host3.attachShadow({mode:"open"}); |
| 36 | + root3.innerHTML = `اختبر`; |
| 37 | + let span = host3; |
| 38 | + assert_equals(getComputedStyle(span).direction, "ltr"); |
| 39 | + assert_true(span.matches(":dir(ltr)")); |
| 40 | +}, 'Slots: Directionality: dir=auto on host with Arabic shadow tree content'); |
27 | 41 |
|
28 |
| -let root5 = host5.attachShadow({mode:"open"}); |
| 42 | +test(() => { |
| 43 | + let root4 = host4.attachShadow({mode:"open"}); |
| 44 | + root4.innerHTML = ''; |
| 45 | + let span = root4.querySelector("span"); |
| 46 | + assert_equals(getComputedStyle(span).direction, "ltr"); |
| 47 | + assert_true(span.matches(":dir(ltr)")); |
| 48 | +}, 'Slots: Directionality: dir=auto in shadow tree with Arabic light tree content'); |
| 49 | + |
| 50 | +test(() => { |
| 51 | + let root5 = host5.attachShadow({mode:"open"}); |
29 | 52 | root5.innerHTML = 'اختبر';
|
| 53 | + let span = root5.querySelector("span"); |
| 54 | + assert_equals(getComputedStyle(span).direction, "rtl"); |
| 55 | + assert_true(span.matches(":dir(rtl)")); |
| 56 | +}, 'Slots: Directionality: dir=auto in shadow tree with Arabic shadow tree content'); |
30 | 57 |
|
31 | 58 | test(() => {
|
32 |
| - assert_equals(getComputedStyle(host1.firstChild).direction, "rtl"); |
33 |
| - assert_equals(getComputedStyle(root2.querySelector("span")).direction, "rtl"); |
34 |
| - assert_equals(getComputedStyle(host3).direction, "ltr"); |
35 |
| - assert_equals(getComputedStyle(root4.querySelector("span")).direction, "rtl"); |
36 |
| - assert_equals(getComputedStyle(root5.querySelector("span")).direction, "rtl"); |
37 |
| -}, 'Slots: Directionality'); |
| 59 | + let root6 = host6.attachShadow({mode:"open"}); |
| 60 | + root6.innerHTML = ''; |
| 61 | + let span = root6.querySelector("slot"); |
| 62 | + assert_equals(getComputedStyle(span).direction, "rtl"); |
| 63 | + assert_true(span.matches(":dir(rtl)")); |
| 64 | +}, 'Slots: Directionality: dir=auto on slot with Arabic light tree content'); |
| 65 | + |
38 | 66 | script>
|
0 commit comments