summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/accname/name/shadowdom/slot.html
blob: 41ccd5a57f452b0041510482b67207c0ef0e10c9 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/wai-aria/scripts/aria-utils.js"></script>

 <p>Tests the shadow DOM slots portions of the AccName <em>Name Computation</em> algorithm, coming in <a href="https://github.com/w3c/accname/pull/167">ARIA #167</a>.</p>

<label id="label1">
  <div id="host1">slotted</div>
</label>
<button id="labelled1"
        class="labelled"
        type="button"
        aria-labelledby="label1"
        data-expectedlabel="foo slotted bar"
        data-testname="aria-labelledby reference to element with slotted text content"></button>

<label id="label2">
  <div id="host2"></div>
</label>
<button id="labelled2"
        class="labelled"
        type="button"
        aria-labelledby="label2"
        data-expectedlabel="foo default bar"
        data-testname="aria-labelledby reference to element with default slotted text content"></button>

<label id="label3">
  <div id="host3">slotted</div>
</label>
<button id="labelled3"
        class="labelled"
        type="button"
        aria-labelledby="label3"
        data-expectedlabel="foo slotted bar"
        data-testname="aria-labelledby reference to element with slotted text content and aria-label on slot"></button>

<label id="label4">
  <div id="host4"></div>
</label>
<button id="labelled4"
        class="labelled"
        type="button"
        aria-labelledby="label4"
        data-expectedlabel="foo default bar"
        data-testname="aria-labelledby reference to element with default slotted text content and aria-label on slot"></button>

<script>

document.getElementById('host1').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot></slot> bar';
document.getElementById('host2').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot>default</slot> bar';
document.getElementById('host3').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label"></slot> bar';
document.getElementById('host4').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label">default</slot> bar';

AriaUtils.verifyLabelsBySelector('.labelled');

</script>