| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 p::first-letter { |
| 6 font-size: 200%; |
| 7 } |
| 8 </style> |
| 9 <h1 id="heading">Test heading</h1> |
| 10 <p id="text">Test text</p> |
| 11 <script> |
| 12 test(function () { |
| 13 if (!window.accessibilityController) { |
| 14 assert_unreached("This test requires accessibilityController."); |
| 15 return; |
| 16 } |
| 17 |
| 18 // Test an element that gets its own accessible name. |
| 19 let element = accessibilityController.accessibleElementById("heading"); |
| 20 assert_equals(element.name, "Test heading"); |
| 21 |
| 22 function getAccessibilityChildren(element) { |
| 23 let children = []; |
| 24 let childrenCount = element.childrenCount; |
| 25 for (let i = 0; i < childrenCount; i++) { |
| 26 let child = element.childAtIndex(i); |
| 27 children.push(child); |
| 28 child.children = getAccessibilityChildren(child); |
| 29 } |
| 30 return children; |
| 31 } |
| 32 |
| 33 // Test by concatenating names of all children. |
| 34 element = accessibilityController.accessibleElementById("text"); |
| 35 let children = getAccessibilityChildren(element); |
| 36 assert_equals(children.length, 1); |
| 37 let name = children.map(e => e.name).join(''); |
| 38 assert_equals(name, "Test text"); |
| 39 }); |
| 40 </script> |
| OLD | NEW |