|
Line 0
a/LayoutTests/fast/forms/focus-with-display-block.html_sec1
|
|
|
1 |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> |
| 5 |
<script src="../../fast/js/resources/js-test-pre.js"></script> |
| 6 |
<style> |
| 7 |
output, meter, progress { |
| 8 |
display: block; |
| 9 |
} |
| 10 |
</style> |
| 11 |
</head> |
| 12 |
<body> |
| 13 |
<p id="description"></p> |
| 14 |
<div id="console"></div> |
| 15 |
<script> |
| 16 |
description('This test ensures that <output>, <meter> and <progress> are not focused.'); |
| 17 |
|
| 18 |
function moveFocus(element) { |
| 19 |
if (window.layoutTestController) |
| 20 |
eventSender.keyDown('\t'); |
| 21 |
else |
| 22 |
element.focus(); |
| 23 |
} |
| 24 |
|
| 25 |
function checkFocus() { |
| 26 |
var active = document.activeElement.nodeName; |
| 27 |
if (active == "OUTPUT" || active == "METER" || active == "PROGRESS") { |
| 28 |
debug(active + ' should not have focus.'); |
| 29 |
return false; |
| 30 |
} |
| 31 |
return true; |
| 32 |
} |
| 33 |
|
| 34 |
var input = document.createElement('input'); |
| 35 |
var output = document.createElement('output'); |
| 36 |
var progress = document.createElement('progress'); |
| 37 |
var meter = document.createElement('meter'); |
| 38 |
|
| 39 |
// Set a placeholder text to the output element to display the element. |
| 40 |
output.innerHTML = 'Text in output element'; |
| 41 |
|
| 42 |
document.body.appendChild(input); |
| 43 |
document.body.appendChild(output); |
| 44 |
document.body.appendChild(progress); |
| 45 |
document.body.appendChild(meter); |
| 46 |
|
| 47 |
debug('- Moves the focus by using keyDown() in DRT, otherwise using element.focus().'); |
| 48 |
debug('- checkFocus() returns true when <output>, <meter> and <progress> do not have focus.'); |
| 49 |
|
| 50 |
moveFocus(input); |
| 51 |
shouldBeTrue('checkFocus()'); |
| 52 |
moveFocus(output); |
| 53 |
shouldBeTrue('checkFocus()'); |
| 54 |
moveFocus(progress); |
| 55 |
shouldBeTrue('checkFocus()'); |
| 56 |
moveFocus(meter); |
| 57 |
shouldBeTrue('checkFocus()'); |
| 58 |
|
| 59 |
var successfullyParsed = true; |
| 60 |
</script> |
| 61 |
<script src="../../fast/js/resources/js-test-post.js"></script> |
| 62 |
</body> |
| 63 |
</html> |