File: dir-slots-directionality.tentative.html

package info (click to toggle)
thunderbird 1%3A91.13.0-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,953,400 kB
  • sloc: cpp: 6,084,049; javascript: 4,790,441; ansic: 3,341,496; python: 862,958; asm: 366,542; xml: 204,277; java: 152,477; sh: 111,436; makefile: 21,388; perl: 15,312; yacc: 4,583; objc: 3,026; lex: 1,720; exp: 762; pascal: 635; awk: 564; sql: 453; php: 436; lisp: 432; ruby: 99; sed: 69; csh: 45
file content (38 lines) | stat: -rw-r--r-- 1,618 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!doctype html>
<title>HTML Test: dir=auto|rtl with slots, and direction should be RTL</title>
<meta charset="UTF-8">
<meta name="author" title="Miyoung Shin" href="mailto:myid.shin@igalia.com">
<meta name="assert" content="When dir='auto', the direction is set according to
  slot's assigned node. And the direction should be propagated to shadow" />
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-dir-attribute"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="host1"><span></span></div>
<div id="host2" dir="rtl"></div>
<span id="host3" dir="auto"></span>
<div id="host4">اختبر</div>
<div id="host5"></div>
<script>
let root1 = host1.attachShadow({mode:"open"});
root1.innerHTML = '<slot dir="rtl"></slot>';

let root2 = host2.attachShadow({mode:"open"});
root2.innerHTML = '<span></span>';

let root3 = host3.attachShadow({mode:"open"});
root3.innerHTML = `اختبر`;

let root4 = host4.attachShadow({mode:"open"});
root4.innerHTML = '<span dir="auto"><slot></slot></span>';

let root5 = host5.attachShadow({mode:"open"});
  root5.innerHTML = '<span dir="auto"><slot>اختبر</slot></span>';

test(() => {
  assert_equals(getComputedStyle(host1.firstChild).direction, "rtl");
  assert_equals(getComputedStyle(root2.querySelector("span")).direction, "rtl");
  assert_equals(getComputedStyle(host3).direction, "rtl");
  assert_equals(getComputedStyle(root4.querySelector("span")).direction, "rtl");
  assert_equals(getComputedStyle(root5.querySelector("span")).direction, "rtl");
}, 'Slots: Directionality');
</script>