| Index: third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..199e32e49177a903e129d54f0d9e1c05d1a2e11e
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html
|
| @@ -0,0 +1,50 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<label inert for="submit">Label for Submit</label>
|
| +<input id="text" type="text">
|
| +<input id="submit" type="submit">
|
| +<script>
|
| +function clickOn(element) {
|
| + return new Promise(function(resolve, reject) {
|
| + if (!window.eventSender)
|
| + reject();
|
| +
|
| + var absoluteTop = 0;
|
| + var absoluteLeft = 0;
|
| + for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) {
|
| + absoluteLeft += parentNode.offsetLeft;
|
| + absoluteTop += parentNode.offsetTop;
|
| + }
|
| +
|
| + var x = absoluteLeft + element.offsetWidth / 2;
|
| + var y = absoluteTop + element.offsetHeight / 2;
|
| + var pointerActions = [{
|
| + source: "mouse",
|
| + actions: [
|
| + { name: "pointerMove", x: x, y: y },
|
| + { name: "pointerDown", x: x, y: x },
|
| + { name: "pointerUp" },
|
| + { name: "pointerMove", x: 0, y: 0}
|
| + ]
|
| + }];
|
| + chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve);
|
| + });
|
| +}
|
| +
|
| +document.querySelector('#text').focus();
|
| +
|
| +test(function() {
|
| + label = document.querySelector('label');
|
| + label.focus();
|
| + assert_equals(document.activeElement, document.querySelector('#submit'));
|
| +}, 'Calling focus() on an inert label should still send focus to its target.');
|
| +
|
| +test(function() {
|
| + clickOn(label).then(() => {
|
| + assert_equals(document.activeElement, document.body);
|
| + });
|
| +}, 'Clicking on an inert label should send focus to document.body.');
|
| +</script>
|
| +</html>
|
|
|