| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 |
| 5 <style> |
| 6 .hideAllContainers .container { display: none; } |
| 7 </style> |
| 8 |
| 9 <div class="container"> |
| 10 <ul id="tablist" role="tablist"> |
| 11 <li id="tab" role="tab" aria-controls="panel"></li> |
| 12 </ul> |
| 13 <div id="panel" role="tabpanel">Panel</div> |
| 14 </div> |
| 15 |
| 16 <script> |
| 17 test(function(t) |
| 18 { |
| 19 var axTab = accessibilityController.accessibleElementById('tab'); |
| 20 var panel = document.getElementById('panel'); |
| 21 var axPanel = accessibilityController.accessibleElementById('panel'); |
| 22 assert_equals(axTab.ariaControlsElementAtIndex(0), axPanel); |
| 23 panel.style.display = 'none'; |
| 24 assert_not_equals(axTab.ariaControlsElementAtIndex(0), axPanel); |
| 25 |
| 26 // Restore the "display" attribute and test with "visibility". |
| 27 panel.style.display = 'initial'; |
| 28 axPanel = accessibilityController.accessibleElementById('panel'); |
| 29 assert_equals(axTab.ariaControlsElementAtIndex(0), axPanel); |
| 30 panel.style.visibility = 'hidden'; |
| 31 assert_not_equals(axTab.ariaControlsElementAtIndex(0), axPanel); |
| 32 }, 'aria-controls should ignore hidden targets.'); |
| 33 </script> |
| 34 |
| 35 <div class="container"> |
| 36 <h1 id="headingWithFlowtos" aria-flowto="item1 item2">Heading</h1> |
| 37 <ul id="flowtoItems"> |
| 38 <li id="item1">One</li> |
| 39 <li id="item2">Two</li> |
| 40 </ul> |
| 41 </div> |
| 42 |
| 43 <script> |
| 44 test(function(t) |
| 45 { |
| 46 var axHeading = accessibilityController.accessibleElementById('headingWithFl
owtos'); |
| 47 var flowtoItems = document.getElementById('flowtoItems'); |
| 48 var item1 = document.getElementById('item1'); |
| 49 var axItem1 = accessibilityController.accessibleElementById('item1'); |
| 50 var item2 = document.getElementById('item2'); |
| 51 var axItem2 = accessibilityController.accessibleElementById('item2'); |
| 52 |
| 53 assert_equals(axHeading.ariaFlowToElementAtIndex(0), axItem1); |
| 54 assert_equals(axHeading.ariaFlowToElementAtIndex(1), axItem2); |
| 55 |
| 56 item2.style.display = 'none'; |
| 57 assert_equals(axHeading.ariaFlowToElementAtIndex(0), axItem1); |
| 58 assert_not_equals(axHeading.ariaFlowToElementAtIndex(1), axItem2); |
| 59 |
| 60 // Restore the "display" attribute and test with "visibility". |
| 61 item2.style.display = 'initial'; |
| 62 axItem2 = accessibilityController.accessibleElementById('item2'); |
| 63 item1.style.visibility = 'hidden'; |
| 64 assert_equals(axHeading.ariaFlowToElementAtIndex(0), axItem2); |
| 65 |
| 66 flowtoItems.style.display = 'none'; |
| 67 assert_not_equals(axHeading.ariaFlowToElementAtIndex(0), axItem2); |
| 68 }, 'aria-flowto should ignore hidden targets.'); |
| 69 </script> |
| 70 |
| 71 <script> |
| 72 if (window.testRunner) |
| 73 document.body.className = "hideAllContainers"; |
| 74 </script> |
| OLD | NEW |