| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.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 <output>, <meter> and <progress> 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 <output>, <meter> and <progress> do not have focus.'); |
| |
| moveFocus(input); |
| shouldBeTrue('checkFocus()'); |
| moveFocus(output); |
| shouldBeTrue('checkFocus()'); |
| moveFocus(progress); |
| shouldBeTrue('checkFocus()'); |
| moveFocus(meter); |
| shouldBeTrue('checkFocus()'); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |