Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic accname tests for shadow DOM #36541

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions accname/name/shadowdom/basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!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>

<label id="label1">
<div id="host1"></div>
</label>
<button id="labelled1"
class="labelled"
type="button"
aria-labelledby="label1"
data-expectedlabel="foo"
data-testname="content inside shadow DOM"></button>
cookiecrook marked this conversation as resolved.
Show resolved Hide resolved

<label id="label2">
<div id="host2"></div>
</label>
<button id="labelled2"
class="labelled"
type="button"
aria-labelledby="label2"
data-expectedlabel="bar"
data-testname="aria-label inside shadow DOM"></button>
cookiecrook marked this conversation as resolved.
Show resolved Hide resolved
<script>

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

AriaUtils.verifyLabelsBySelector('.labelled');

</script>
58 changes: 58 additions & 0 deletions accname/name/shadowdom/slot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!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>

<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="slotted content"></button>
cookiecrook marked this conversation as resolved.
Show resolved Hide resolved

<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="default slotted 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-label on slot with slotted content"></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-label on slot with default slotted content"></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>