| 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..5b01dd7ba7f85ca925929cbc60dafaa33756d59d
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html
|
| @@ -0,0 +1,41 @@
|
| +<!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) {
|
| + if (!window.eventSender)
|
| + return;
|
| +
|
| + 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;
|
| + eventSender.mouseMoveTo(x, y);
|
| + eventSender.mouseDown();
|
| + eventSender.mouseUp();
|
| + eventSender.mouseMoveTo(0, 0);
|
| +}
|
| +
|
| +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);
|
| + assert_equals(document.activeElement, document.body);
|
| +}, 'Clicking on an inert label should send focus to document.body.');
|
| +</script>
|
| +</html>
|
|
|