Skip to content

Commit

Permalink
Bug 1488178 [wpt PR 12800] - HTML: test accesskey for legend, a=testonly
Browse files Browse the repository at this point in the history
Automatic update from web-platform-testsHTML: test accesskey for legend

See whatwg/html#3987
--

wpt-commits: de955843cde5540bfc63015490630beeb1f19f89
wpt-pr: 12800
  • Loading branch information
zcorpan authored and moz-wptsync-bot committed Sep 12, 2018
1 parent 10ea73d commit 5c23e44
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 0 deletions.
89 changes: 89 additions & 0 deletions testing/web-platform/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -13009,6 +13009,54 @@
{}
]
],
"html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/label-sibling-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/label-sibling-manual.html",
{}
]
],
"html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html": [
[
"/html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html",
{}
]
],
"html/semantics/selectors/pseudo-classes/checked-001-manual.html": [
[
"/html/semantics/selectors/pseudo-classes/checked-001-manual.html",
Expand Down Expand Up @@ -289807,6 +289855,11 @@
{}
]
],
"html/semantics/interactive-elements/commands/common/accesskey.js": [
[
{}
]
],
"html/semantics/interactive-elements/commands/contains.json": [
[
{}
Expand Down Expand Up @@ -609852,10 +609905,46 @@
"c1dd8dddf9eec3ab3fb58df01c549c251f3a3fdf",
"support"
],
"html/semantics/interactive-elements/commands/common/accesskey.js": [
"f08761be8c1fc618e42369a3358c0dbf8a848bea",
"support"
],
"html/semantics/interactive-elements/commands/contains.json": [
"b2ca2e771bd9f7c82c2e955a88ac6fc6010c48a7",
"support"
],
"html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html": [
"521b4bb975530880caac863d96b167cd08abc7a0",
"manual"
],
"html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html": [
"1c40cc7b81e9a866df97f7d386c688de8f1b3bc7",
"manual"
],
"html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html": [
"abd3a3b2dfe36cab4b267273b6616d60eab07046",
"manual"
],
"html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html": [
"e2880a77bf9592776ce58bb0fbbfcd1df2581b5a",
"manual"
],
"html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html": [
"49dcaaf7d54e15ee6e2d6e893e5f4be55d4d96e5",
"manual"
],
"html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html": [
"dc6af48323e49c85b9f09d335f9d8dd19979d17c",
"manual"
],
"html/semantics/interactive-elements/commands/legend/label-sibling-manual.html": [
"8a7b20565f77e3e55600b698ef0780d762fa7ebb",
"manual"
],
"html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html": [
"e7abb71454a43ce226b2cc5da496889635b33ab8",
"manual"
],
"html/semantics/interactive-elements/contextmenu-historical.html": [
"f723d3a92aab226fd82295a81209c3e25882bcb1",
"testharness"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
setup({explicit_done: true, explicit_timeout: true});

const NOTRUN = 3;
let status = NOTRUN;
function notrun() {
return status === NOTRUN;
}
add_completion_callback(tests => {
status = tests[0].status;
});

function pass() {
// Wait a couple of frames in case fail() is also called.
requestAnimationFrame(() => {
requestAnimationFrame(() => {
if (notrun()) {
test(() => {});
done();
}
});
});
}

function fail(msg) {
if (notrun()) {
test(() => { assert_unreached(msg); });
done();
}
}

document.addEventListener('DOMContentLoaded', () => {
const accessKeyElement = document.querySelector('[accesskey]');
if (accessKeyElement.accessKeyLabel) {
document.querySelector('kbd').textContent = accessKeyElement.accessKeyLabel;
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<title>First input after the legend</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<fieldset>
<legend accesskey=a>legend</legend>
<input onfocus="pass()">
</fieldset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<title>First input before the legend</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<fieldset>
<input onfocus="pass()">
<legend accesskey=a>legend
<input onfocus="fail('input in legend was focused')">
</legend>
<input onfocus="fail('input after legend was focused')">
</fieldset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<title>First input inside the legend</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<fieldset>
<legend accesskey=a>legend
<input onfocus="pass()">
</legend>
<input onfocus="fail('input after legend was focused')">
</fieldset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<title>Focusable legend</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<fieldset>
<legend tabindex=0 onclick="fail('unexpected click event on legend')"
onfocus="fail('legend was focused')" accesskey=a>
legend
<input onfocus="pass()">
</legend>
<input onfocus="fail('input after legend was focused')">
</fieldset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<title>Focusable legend sibling</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<fieldset>
<legend accesskey=a>first legend</legend>
<legend tabindex=0 onfocus="fail('sibling legend was focused')">second legend</legend>
</fieldset>
<script>
onkeyup = e => {
if (e.keyCode === 65) {
pass();
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<title>Input outside fieldset</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<fieldset>
<legend accesskey=a>legend</legend>
</fieldset>
<input onfocus="fail('input outside fieldset was focused')">
<script>
onkeyup = e => {
if (e.keyCode === 65) {
pass();
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<title>Label sibling</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<input id=x onfocus="fail('input associated with the label was focused')">
<fieldset>
<legend accesskey=a>legend</legend>
<label for=x onclick="fail('label received a click event')">label</label>
</fieldset>
<script>
onkeyup = e => {
if (e.keyCode === 65) {
pass();
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<title>No fieldset parent</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../common/accesskey.js></script>
<p>Press the access key combination for "a". <kbd></kbd></p>
<legend accesskey=a>
legend
<input onfocus="fail('input in legend was focused')">
</legend>
<input onfocus="fail('input after legend was focused')">
<script>
onkeyup = e => {
if (e.keyCode === 65) {
pass();
}
}
</script>

0 comments on commit 5c23e44

Please sign in to comment.