slot.html (2314B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-vendor.js"></script> 6 <script src="/resources/testdriver-actions.js"></script> 7 <script src="/wai-aria/scripts/aria-utils.js"></script> 8 9 <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> 10 11 <label id="label1"> 12 <div id="host1">slotted</div> 13 </label> 14 <button id="labelled1" 15 class="labelled" 16 type="button" 17 aria-labelledby="label1" 18 data-expectedlabel="foo slotted bar" 19 data-testname="aria-labelledby reference to element with slotted text content"></button> 20 21 <label id="label2"> 22 <div id="host2"></div> 23 </label> 24 <button id="labelled2" 25 class="labelled" 26 type="button" 27 aria-labelledby="label2" 28 data-expectedlabel="foo default bar" 29 data-testname="aria-labelledby reference to element with default slotted text content"></button> 30 31 <label id="label3"> 32 <div id="host3">slotted</div> 33 </label> 34 <button id="labelled3" 35 class="labelled" 36 type="button" 37 aria-labelledby="label3" 38 data-expectedlabel="foo slotted bar" 39 data-testname="aria-labelledby reference to element with slotted text content and aria-label on slot"></button> 40 41 <label id="label4"> 42 <div id="host4"></div> 43 </label> 44 <button id="labelled4" 45 class="labelled" 46 type="button" 47 aria-labelledby="label4" 48 data-expectedlabel="foo default bar" 49 data-testname="aria-labelledby reference to element with default slotted text content and aria-label on slot"></button> 50 51 <script> 52 53 document.getElementById('host1').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot></slot> bar'; 54 document.getElementById('host2').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot>default</slot> bar'; 55 document.getElementById('host3').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label"></slot> bar'; 56 document.getElementById('host4').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label">default</slot> bar'; 57 58 AriaUtils.verifyLabelsBySelector('.labelled'); 59 60 </script>