OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <body> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../forms/resources/common.js"></script> |
| 6 <div id="log"></div> |
| 7 <div id="container"></div> |
| 8 <script> |
| 9 if (!window.eventSender) |
| 10 document.body.textContent = 'This test requires window.eventSender.'; |
| 11 |
| 12 test(function() { |
| 13 var container = document.querySelector('#container'); |
| 14 container.innerHTML = '<input id=prev><div style="height:200px;"><span>text<
/span></div><input id=next>'; |
| 15 hoverOverElement(container.querySelector('span')); |
| 16 eventSender.mouseDown(); |
| 17 eventSender.keyDown('\t'); |
| 18 assert_equals(document.activeElement.id, 'next'); |
| 19 |
| 20 hoverOverElement(container.querySelector('div')); |
| 21 eventSender.mouseDown(); |
| 22 eventSender.keyDown('\t', ['shiftKey']); |
| 23 assert_equals(document.activeElement.id, 'prev'); |
| 24 }, 'Mouse press should update sequential focus navigation starting point.'); |
| 25 |
| 26 test(function() { |
| 27 var container = document.querySelector('#container'); |
| 28 container.innerHTML = '<a href="#fragment"></a><input id=prev><a name="fragm
ent"></a><input id=next>'; |
| 29 container.querySelector('a').click(); |
| 30 eventSender.keyDown('\t'); |
| 31 assert_equals(document.activeElement.id, 'next'); |
| 32 }, 'Fragment navigation should update sequential focus navigation starting point
.'); |
| 33 |
| 34 test(function() { |
| 35 var container = document.querySelector('#container'); |
| 36 container.innerHTML = '<input id=prev><input id=start><input id=next>'; |
| 37 container.querySelector('#start').focus(); |
| 38 container.querySelector('#start').blur(); |
| 39 eventSender.keyDown('\t'); |
| 40 assert_equals(document.activeElement.id, 'next'); |
| 41 }, 'Focusing an element should update sequential focus navigation starting point
.'); |
| 42 |
| 43 test(function() { |
| 44 var container = document.querySelector('#container'); |
| 45 container.innerHTML = '<input id=prev><input id=start><input id=next>'; |
| 46 container.querySelector('#start').focus(); |
| 47 container.querySelector('#start').remove(); |
| 48 eventSender.keyDown('\t'); |
| 49 assert_equals(document.activeElement.id, 'next'); |
| 50 |
| 51 container.innerHTML = '<input id=prev><input id=start><input id=next>'; |
| 52 container.querySelector('#start').focus(); |
| 53 container.querySelector('#start').remove(); |
| 54 eventSender.keyDown('\t', ['shiftKey']); |
| 55 assert_equals(document.activeElement.id, 'prev'); |
| 56 }, 'After removing a focused element from the documen tree, sequential focus nav
igation should start at a place where the focused element was.'); |
| 57 </script> |
| 58 </body> |
OLD | NEW |