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

<label id="label">
<div id="host"></div>
</label>
<button id="test" type="button" aria-labelledby="label"></button>
<script>
document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML = '<div aria-label="foo"></div>';

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('test'));
assert_equals(label, "foo");
}, "tests computed label - aria-label in shadow DOM");

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

<label id="label">
<div id="host"></div>
</label>
<button id="test" type="button" aria-labelledby="label"></button>
<script>

document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML = 'foo';

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('test'));
assert_equals(label, "foo");
}, "tests computed label - text-node in shadow DOM");

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

<label id="label">
<div id="host">slotted</div>
</label>
<button id="test" type="button" aria-labelledby="label"></button>
<script>
document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot></slot> bar';

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('test'));
assert_equals(label, "foo slotted bar");
}, "tests computed label - slotted content");

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

<label id="label">
<div id="host"></div>
</label>
<button id="test" type="button" aria-labelledby="label"></button>
<script>
document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot>default</slot> bar';

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('test'));
assert_equals(label, "foo default bar");
}, "tests computed label - default slotted content");

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

<label id="label">
<div id="host">slotted</div>
</label>
<button id="test" type="button" aria-labelledby="label"></button>
<script>
document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label"></slot> bar';

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('test'));
assert_equals(label, "foo slotted bar");
}, "tests computed label - aria-label on slot with slotted content");

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

<label id="label">
<div id="host"></div>
</label>
<button id="test" type="button" aria-labelledby="label"></button>
<script>
document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label">default</slot> bar'

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('test'));
assert_equals(label, "foo default bar");
}, "tests computed label - aria-label on slot with default slotted content");

</script>