chromium/third_party/blink/web_tests/fast/forms/focus-with-display-block.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
<style>
output, meter, progress {
    display: block;
}
</style>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('This test ensures that &lt;output&gt;, &lt;meter&gt; and &lt;progress&gt; are not focused.');

function moveFocus(element) {
    if (window.testRunner)
        eventSender.keyDown('\t');
    else
        element.focus();
}

function checkFocus() {
    var active = document.activeElement.nodeName;
    if (active == "OUTPUT" || active == "METER" || active == "PROGRESS") {
        debug(active + ' should not have focus.');
        return false;
    }
    return true;
}

var input = document.createElement('input');
var output = document.createElement('output');
var progress = document.createElement('progress');
var meter = document.createElement('meter');

// Set a placeholder text to the output element to display the element.
output.innerHTML = 'Text in output element';

document.body.appendChild(input);
document.body.appendChild(output);
document.body.appendChild(progress);
document.body.appendChild(meter);

debug('- Moves the focus by using keyDown() in DRT, otherwise using element.focus().');
debug('- checkFocus() returns true when &lt;output&gt;, &lt;meter&gt; and &lt;progress&gt; do not have focus.');

moveFocus(input);
shouldBeTrue('checkFocus()');
moveFocus(output);
shouldBeTrue('checkFocus()');
moveFocus(progress);
shouldBeTrue('checkFocus()');
moveFocus(meter);
shouldBeTrue('checkFocus()');
</script>
</body>
</html>