OLD | NEW |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body id="body"> | 6 <body id="body"> |
7 | 7 |
8 <span id="labelShutdown"><label id="labelElement" for="shutdownTime">Shut down c omputer after</label></span> | 8 <span id="labelShutdown"><label id="labelElement" for="shutdownTime">Shut down c omputer after</label></span> |
9 <input id="shutdownTime" type="text" value="10" aria-labelledby="labelShutdown s hutdownTime shutdownUnit" /> | 9 <input id="shutdownTime" type="text" value="10" aria-labelledby="labelShutdown s hutdownTime shutdownUnit" /> |
10 <span id="shutdownUnit">minutes</span> | 10 <span id="shutdownUnit">minutes</span> |
11 | 11 |
12 <p id="description"></p> | 12 <p id="description"></p> |
13 <div id="console"></div> | 13 <div id="console"></div> |
14 | 14 |
15 <script> | 15 <script> |
16 | 16 |
17 description("This tests that if aria-labelledby is used, then label elements are not used"); | 17 description("This tests that if aria-labelledby is used, then label elements are not used"); |
18 | 18 |
19 if (window.accessibilityController) { | 19 if (window.accessibilityController) { |
20 | 20 |
21 var text = document.getElementById("shutdownTime"); | 21 var text = document.getElementById("shutdownTime"); |
22 text.focus(); | 22 text.focus(); |
23 text = accessibilityController.focusedElement; | 23 text = accessibilityController.focusedElement; |
24 | 24 |
25 shouldBe("text.deprecatedDescription", "'AXDescription: Shut down comp uter after 10 minutes'"); | 25 shouldBe("text.name", "'Shut down computer after 10 minutes'"); |
26 | 26 |
27 // There should be no title UI element. | 27 // The first name element should be the span, not the label element. |
28 shouldBe("text.deprecatedTitleUIElement() != null && text.deprecatedTi tleUIElement().isValid", "false"); | 28 var firstNameElement = text.nameElementAtIndex(0); |
29 | 29 shouldBe("firstNameElement.role", "'AXRole: AXUnknown'"); |
aboxhall
2015/11/06 19:24:11
Not a big deal, but this looks a little flaky now
dmazzoni
2015/11/06 22:32:26
Good idea.
I rewrote it to show the label is not
| |
30 | |
30 var labelElement = accessibilityController.accessibleElementById("labe lElement"); | 31 var labelElement = accessibilityController.accessibleElementById("labe lElement"); |
31 // This just makes sure that the label element is still visible in the AX hierarchy, even though | 32 // This just makes sure that the label element is still visible in the AX hierarchy, even though |
32 // it's a label element (sometimes they are ignored). | 33 // it's a label element (sometimes they are ignored). |
33 debug("Label element role is: " + labelElement.role); | 34 debug("Label element role is: " + labelElement.role); |
34 } | 35 } |
35 | 36 |
36 </script> | 37 </script> |
37 | 38 |
38 </body> | 39 </body> |
39 </html> | 40 </html> |
OLD | NEW |