Update web-platform-tests to revision 9a5d71b326166e12784bdd9d161772e20f87c1fd

This commit is contained in:
WPT Sync Bot 2018-09-07 21:37:42 -04:00
parent f7630dad87
commit 4ae3d09ff3
86 changed files with 2739 additions and 640 deletions

View file

@ -0,0 +1,17 @@
<!doctype html>
<title>legend focusable</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
const t = async_test();
</script>
<fieldset>
<legend tabindex=0 onfocus="t.step(() => { t.done(); })">
legend
<input onfocus="t.unreached_func('input in legend was focused')();">
</legend>
<input onfocus="t.unreached_func('input after legend was focused')();">
</fieldset>
<script>
document.querySelector('legend').focus();
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>legend</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
const t = async_test();
</script>
<fieldset>
<legend onfocus="t.unreached_func('legend was focused')()">
legend
<input onfocus="t.unreached_func('input in legend was focused')();">
</legend>
<input onfocus="t.unreached_func('input after legend was focused')();">
</fieldset>
<script>
document.querySelector('legend').focus();
t.step_timeout(() => {
t.done();
}, 500);
</script>

View file

@ -0,0 +1,27 @@
<!doctype html>
<title>legend align does not map to text-align</title>
<!-- See discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1488228 -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
legend { width: 13em }
</style>
<fieldset><legend>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset>
<fieldset><legend align=left>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset>
<fieldset><legend align=center>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset>
<fieldset><legend align=right>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset>
<fieldset><legend align=justify>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset>
<script>
function test_align(selectorTest, expectedAlign) {
const testElm = document.querySelector(selectorTest);
test(() => {
assert_equals(getComputedStyle(testElm).textAlign, expectedAlign);
}, selectorTest);
}
test_align('legend', 'start');
for (const val of ['left', 'center', 'right', 'justify']) {
test_align(`legend[align=${val}]`, 'start');
}
</script>

View file

@ -5,6 +5,7 @@
<fieldset><legend align=left>x</legend></fieldset>
<fieldset><legend align=center>x</legend></fieldset>
<fieldset><legend align=right>x</legend></fieldset>
<fieldset><legend align=justify>x</legend></fieldset>
<div align=left>
<fieldset><legend>x</legend></fieldset>
</div>
@ -14,6 +15,9 @@
<div align=right>
<fieldset><legend>x</legend></fieldset>
</div>
<div align=justify>
<fieldset><legend>x</legend></fieldset>
</div>
<div style="text-align: center">
<fieldset><legend>x</legend></fieldset>
</div>
@ -33,12 +37,12 @@ function test_align(selectorTest, selectorRef) {
}, selectorTest);
}
for (const val of ['left', 'center', 'right']) {
test_align(`div[align=${val}] legend`, `legend[align=${val}]`);
for (const val of ['left', 'center', 'right', 'justify']) {
test_align(`div[align=${val}] legend`, `legend[align=left]`);
}
test_align(`div[style="text-align: center"] legend`, `legend[align=left]`);
test_align(`div[style="text-align: center"][align=center] legend`, `legend[align=center]`);
test_align(`div[style="text-align: center"][align=center] legend`, `legend[align=left]`);
test_align(`legend[style="margin: 0 auto"]`, `legend[align=center]`);
test_align(`legend[style="margin: 0 0 0 auto"]`, `legend[align=right]`);
test_align(`fieldset[dir=rtl] legend`, `legend[align=right]`);

View file

@ -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;
}
});

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>