| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 | 4 |
| 5 <div id="main"> | 5 <div id="main"> |
| 6 <a id="anchor1" href="#emptyAnchor">Empty anchor</a> | 6 <a id="anchor1" href="#emptyAnchor">Empty anchor</a> |
| 7 <a id="anchor2" href="#anchorWithContent">Anchor with content</a> | 7 <a id="anchor2" href="#anchorWithContent">Anchor with content</a> |
| 8 <a id="anchor3" href="#anchorWithID">Anchor with ID</a> | 8 <a id="anchor3" href="#anchorWithID">Anchor with ID</a> |
| 9 <a id="anchor4" href="#emptySpan">Empty span</a> | 9 <a id="anchor4" href="#emptySpan">Empty span</a> |
| 10 <a id="anchor5" href="#spanWithContent">Span with content</a> | 10 <a id="anchor5" href="#spanWithContent">Span with content</a> |
| 11 <a id="anchor6" href="#paragraphWithContent">Paragraph with content</a> | 11 <a id="anchor6" href="#paragraphWithContent">Paragraph with content</a> |
| 12 | 12 |
| 13 <p><a name="emptyAnchor"></a>After empty anchor</p> | 13 <p><a name="emptyAnchor"></a>After empty anchor</p> |
| 14 <p><a name="anchorWithContent">Anchor with content</a></p> | 14 <p><a name="anchorWithContent">Anchor with content</a></p> |
| 15 <p><a id="anchorWithID">Anchor with ID</a></p> | 15 <p><a id="anchorWithID">Anchor with ID</a></p> |
| 16 <p><span id="emptySpan"></span>After empty span</span></p> | 16 <p><span id="emptySpan"></span>After empty span</span></p> |
| 17 <p><span id="spanWithContent">Span with content</span></p> | 17 <p><span id="spanWithContent">Span with content</span></p> |
| 18 <p id="paragraphWithContent">Paragraph with content</p> | 18 <p id="paragraphWithContent">Paragraph with content</p> |
| 19 </div> | 19 </div> |
| 20 | 20 |
| 21 <script> | 21 <script> |
| 22 test(function() { | 22 test(function() { |
| 23 var anchor = accessibilityController.accessibleElementById('anchor1'); | 23 var anchor = accessibilityController.accessibleElementById('anchor1'); |
| 24 assert_not_equals(anchor, undefined); | 24 assert_not_equals(anchor, undefined); |
| 25 var target = anchor.inPageLinkTarget; | 25 var target = anchor.inPageLinkTarget; |
| 26 assert_not_equals(target, undefined); | 26 assert_not_equals(target, undefined); |
| 27 assert_equals(target.role, 'AXRole: AXStaticText'); | 27 // AXAncor because this is how the "a" tag is marked in the accessibility tree |
| 28 assert_equals(target.name, 'After empty anchor'); | 28 // when it's a target and not a link. |
| 29 assert_equals(target.role, 'AXRole: AXAnchor'); |
| 30 assert_equals(target.name, ''); |
| 29 }, 'Test finding the target when it is an empty anchor.'); | 31 }, 'Test finding the target when it is an empty anchor.'); |
| 30 | 32 |
| 31 test(function() { | 33 test(function() { |
| 32 var anchor = accessibilityController.accessibleElementById('anchor2'); | 34 var anchor = accessibilityController.accessibleElementById('anchor2'); |
| 33 assert_not_equals(anchor, undefined); | 35 assert_not_equals(anchor, undefined); |
| 34 var target = anchor.inPageLinkTarget; | 36 var target = anchor.inPageLinkTarget; |
| 35 assert_not_equals(target, undefined); | 37 assert_not_equals(target, undefined); |
| 36 // AXStaticText because this is how the "a" tag is marked in the accessibility | 38 // AXAncor because this is how the "a" tag is marked in the accessibility tree |
| 37 // tree when it's a target and not a link. | 39 // when it's a target and not a link. |
| 38 assert_equals(target.role, 'AXRole: AXStaticText'); | 40 assert_equals(target.role, 'AXRole: AXAnchor'); |
| 39 assert_equals(target.name, 'Anchor with content'); | 41 assert_equals(target.name, 'Anchor with content'); |
| 40 }, 'Test finding the target when it is an anchor with content.'); | 42 }, 'Test finding the target when it is an anchor with content.'); |
| 41 | 43 |
| 42 test(function() { | 44 test(function() { |
| 43 var anchor = accessibilityController.accessibleElementById('anchor3'); | 45 var anchor = accessibilityController.accessibleElementById('anchor3'); |
| 44 assert_not_equals(anchor, undefined); | 46 assert_not_equals(anchor, undefined); |
| 45 var target = anchor.inPageLinkTarget; | 47 var target = anchor.inPageLinkTarget; |
| 46 assert_not_equals(target, undefined); | 48 assert_not_equals(target, undefined); |
| 47 // AXStaticText because this is how the "a" tag is marked in the accessibility | 49 // AXAncor because this is how the "a" tag is marked in the accessibility tree |
| 48 // tree when it's a target and not a link. | 50 // when it's a target and not a link. |
| 49 assert_equals(target.role, 'AXRole: AXStaticText'); | 51 assert_equals(target.role, 'AXRole: AXAnchor'); |
| 50 assert_equals(target.name, 'Anchor with ID'); | 52 assert_equals(target.name, 'Anchor with ID'); |
| 51 }, 'Test finding the target when it is an anchor with ID.'); | 53 }, 'Test finding the target when it is an anchor with ID.'); |
| 52 | 54 |
| 53 test(function() { | 55 test(function() { |
| 54 var anchor = accessibilityController.accessibleElementById('anchor4'); | 56 var anchor = accessibilityController.accessibleElementById('anchor4'); |
| 55 assert_not_equals(anchor, undefined); | 57 assert_not_equals(anchor, undefined); |
| 56 var target = anchor.inPageLinkTarget; | 58 var target = anchor.inPageLinkTarget; |
| 57 assert_not_equals(target, undefined); | 59 assert_not_equals(target, undefined); |
| 58 assert_equals(target.role, 'AXRole: AXStaticText'); | 60 assert_equals(target.role, 'AXRole: AXStaticText'); |
| 59 assert_equals(target.name, 'After empty span'); | 61 assert_equals(target.name, 'After empty span'); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 var target = anchor.inPageLinkTarget; | 76 var target = anchor.inPageLinkTarget; |
| 75 assert_not_equals(target, undefined); | 77 assert_not_equals(target, undefined); |
| 76 assert_equals(target.role, 'AXRole: AXParagraph'); | 78 assert_equals(target.role, 'AXRole: AXParagraph'); |
| 77 }, 'Test finding the target when it is a paragraph.'); | 79 }, 'Test finding the target when it is a paragraph.'); |
| 78 </script> | 80 </script> |
| 79 | 81 |
| 80 <script> | 82 <script> |
| 81 if (window.testRunner) | 83 if (window.testRunner) |
| 82 document.getElementById("main").style.display = "none"; | 84 document.getElementById("main").style.display = "none"; |
| 83 </script> | 85 </script> |
| OLD | NEW |