| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 | 5 |
| 6 <!-- A link always gets its accessible text from contents. --> | 6 <!-- A link always gets its accessible text from contents. --> |
| 7 <a id="link" href="#">A</a> | 7 <a id="link" href="#">A</a> |
| 8 | 8 |
| 9 <!-- A generic focusable div should also get its accessible text from contents.
--> | 9 <!-- A generic focusable div not get its accessible text from contents. --> |
| 10 <div id="div" tabindex="0">B</div> | 10 <div id="div" tabindex="0">B</div> |
| 11 <div id="div2" tabindex="0"><div></div>C</div> | 11 <div id="div2" tabindex="0"><div></div>C</div> |
| 12 <div id="div3" tabindex="0" aria-label="D"></div> | 12 <div id="div3" tabindex="0" aria-label="D"></div> |
| 13 | |
| 14 <!-- A generic focusable div should not get accessible text from children that a
re focusable or containers. --> | |
| 15 <div id="div4" tabindex="0"><a href="#">Link</a></div> | 13 <div id="div4" tabindex="0"><a href="#">Link</a></div> |
| 16 <div id="div5" tabindex="0">Initial text before link<a href="#">Link</a></div> | 14 <div id="div5" tabindex="0">Initial text before link<a href="#">Link</a></div> |
| 17 <div id="div6" tabindex="0"><ul><li>List item</li></ul></div> | 15 <div id="div6" tabindex="0"><ul><li>List item</li></ul></div> |
| 18 <div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul><
/div> | 16 <div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul><
/div> |
| 19 | 17 |
| 20 <div id="console"></div> | 18 <div id="console"></div> |
| 21 <script> | 19 <script> |
| 22 description("This test makes sure that a generic focusable div can get accessibi
lity focus and gets its accessible text from contents.."); | 20 description("This test makes sure that a generic focusable div can get accessibi
lity focus and gets its accessible text from contents.."); |
| 23 | 21 |
| 24 if (window.testRunner && window.accessibilityController) { | 22 if (window.testRunner && window.accessibilityController) { |
| 25 window.testRunner.dumpAsText(); | 23 window.testRunner.dumpAsText(); |
| 26 | 24 |
| 27 function lastChar(str) { | |
| 28 return str.substr(str.length - 1); | |
| 29 } | |
| 30 | |
| 31 var link = document.getElementById('link'); | 25 var link = document.getElementById('link'); |
| 32 link.focus(); | 26 link.focus(); |
| 33 shouldBe("document.activeElement == link", "true"); | 27 shouldBe("document.activeElement == link", "true"); |
| 34 window.axLink = accessibilityController.focusedElement; | 28 window.axLink = accessibilityController.focusedElement; |
| 35 shouldBe("lastChar(axLink.deprecatedTitle)", "\"A\""); | 29 shouldBe("axLink.name", "\"\""); |
| 36 | 30 |
| 37 var div = document.getElementById('div'); | 31 var div = document.getElementById('div'); |
| 38 div.focus(); | 32 div.focus(); |
| 39 shouldBe("document.activeElement == div", "true"); | 33 shouldBe("document.activeElement == div", "true"); |
| 40 window.axDiv = accessibilityController.focusedElement; | 34 window.axDiv = accessibilityController.focusedElement; |
| 41 shouldBe("lastChar(axDiv.deprecatedTitle)", "\"B\""); | 35 shouldBe("axDiv.name", "\"\""); |
| 42 | 36 |
| 43 var div2 = document.getElementById('div2'); | 37 var div2 = document.getElementById('div2'); |
| 44 div2.focus(); | 38 div2.focus(); |
| 45 shouldBe("document.activeElement == div2", "true"); | 39 shouldBe("document.activeElement == div2", "true"); |
| 46 window.axDiv2 = accessibilityController.focusedElement; | 40 window.axDiv2 = accessibilityController.focusedElement; |
| 47 shouldBe("lastChar(axDiv2.deprecatedTitle)", "\"C\""); | 41 shouldBe("axDiv2.name", "\"\""); |
| 48 | 42 |
| 49 var div3 = document.getElementById('div3'); | 43 var div3 = document.getElementById('div3'); |
| 50 div3.focus(); | 44 div3.focus(); |
| 51 shouldBe("document.activeElement == div3", "true"); | 45 shouldBe("document.activeElement == div3", "true"); |
| 52 window.axDiv3 = accessibilityController.focusedElement; | 46 window.axDiv3 = accessibilityController.focusedElement; |
| 53 shouldBe("lastChar(axDiv3.deprecatedDescription)", "\"D\""); | 47 shouldBe("axDiv3.name", "\"\""); |
| 54 | 48 |
| 55 var div4 = document.getElementById('div4'); | 49 var div4 = document.getElementById('div4'); |
| 56 div4.focus(); | 50 div4.focus(); |
| 57 shouldBe("document.activeElement == div4", "true"); | 51 shouldBe("document.activeElement == div4", "true"); |
| 58 window.axDiv4 = accessibilityController.focusedElement; | 52 window.axDiv4 = accessibilityController.focusedElement; |
| 59 shouldBe("axDiv4.deprecatedTitle.indexOf('Link')", "-1"); | 53 shouldBe("axDiv4.name", "\"\""); |
| 60 | 54 |
| 61 var div5 = document.getElementById('div5'); | 55 var div5 = document.getElementById('div5'); |
| 62 div5.focus(); | 56 div5.focus(); |
| 63 shouldBe("document.activeElement == div5", "true"); | 57 shouldBe("document.activeElement == div5", "true"); |
| 64 window.axDiv5 = accessibilityController.focusedElement; | 58 window.axDiv5 = accessibilityController.focusedElement; |
| 65 shouldBe("axDiv5.deprecatedTitle.indexOf('Link')", "-1"); | 59 shouldBe("axDiv5.name", "\"\""); |
| 66 shouldBe("axDiv5.deprecatedTitle.indexOf('Initial text before link') >= 0",
"true"); | |
| 67 | 60 |
| 68 var div6 = document.getElementById('div6'); | 61 var div6 = document.getElementById('div6'); |
| 69 div6.focus(); | 62 div6.focus(); |
| 70 shouldBe("document.activeElement == div6", "true"); | 63 shouldBe("document.activeElement == div6", "true"); |
| 71 window.axDiv6 = accessibilityController.focusedElement; | 64 window.axDiv6 = accessibilityController.focusedElement; |
| 72 shouldBe("axDiv6.deprecatedTitle.indexOf('List item')", "-1"); | 65 shouldBe("axDiv6.name", "\"\""); |
| 73 | 66 |
| 74 var div7 = document.getElementById('div7'); | 67 var div7 = document.getElementById('div7'); |
| 75 div7.focus(); | 68 div7.focus(); |
| 76 shouldBe("document.activeElement == div7", "true"); | 69 shouldBe("document.activeElement == div7", "true"); |
| 77 window.axDiv7 = accessibilityController.focusedElement; | 70 window.axDiv7 = accessibilityController.focusedElement; |
| 78 shouldBe("axDiv7.deprecatedTitle.indexOf('List item')", "-1"); | 71 shouldBe("axDiv7.name", "\"\""); |
| 79 shouldBe("axDiv7.deprecatedTitle.indexOf('Initial text before list') >= 0",
"true"); | |
| 80 } | 72 } |
| 81 | 73 |
| 82 </script> | 74 </script> |
| 83 | 75 |
| 84 </body> | 76 </body> |
| 85 </html> | 77 </html> |
| OLD | NEW |