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 <div role="group" tabindex="0" id="images"> | 8 <img id="img-ignored" alt="" height="100" width="100"> |
9 <img alt="" height="100" width="100"> | 9 <img id="img1" title="test1" height="100" width="100"> |
10 <img title="test1" height="100" width="100"> | 10 <img id="img2" alt="alt" title="test2" height="100" width="100"> |
11 <img alt="alt" title="test2" height="100" width="100"> | 11 <div id="img3" role="img" title="test3" width="100" height="100">test</div> |
12 <div role="img" title="test3" width="100" height="100">test</div> | 12 <div id="img4" role="img" alt="alt" title="test4" width="100" height="100">t
est</div> |
13 <div role="img" alt="alt" title="test4" width="100" height="100">test</div> | |
14 </div> | |
15 | 13 |
16 <p id="description"></p> | 14 <p id="description"></p> |
17 <div id="console"></div> | 15 <div id="console"></div> |
18 | 16 |
19 <script> | 17 <script> |
20 | 18 |
21 description("This tests that images will fallback to using the title attribu
te if no other descriptive text is present."); | 19 description("This tests that images will fallback to using the title attribu
te if no other descriptive text is present."); |
22 | 20 |
23 if (window.accessibilityController) { | 21 if (window.accessibilityController) { |
24 | 22 |
25 document.getElementById("images").focus(); | |
26 var imagesGroup = accessibilityController.focusedElement; | |
27 | |
28 // First image should have a description of "test1" because there is no
alt tag (it should use the title). | 23 // First image should have a description of "test1" because there is no
alt tag (it should use the title). |
29 // The title should NOT be in the description. | 24 // The title should NOT be in the description. |
30 var image1 = imagesGroup.childAtIndex(0).childAtIndex(0); | 25 var image1 = accessibilityController.accessibleElementById("img1"); |
31 debug("Image1 name: " + image1.name); | 26 debug("Image1 name: " + image1.name); |
32 debug("Image1 description: " + image1.description + "<br>"); | 27 debug("Image1 description: " + image1.description + "<br>"); |
33 | 28 |
34 // Second image should use the alt tag instead of the title. | 29 // Second image should use the alt tag instead of the title. |
35 // The description should reflect what's in the title. | 30 // The description should reflect what's in the title. |
36 var image2 = imagesGroup.childAtIndex(0).childAtIndex(1); | 31 var image2 = accessibilityController.accessibleElementById("img2"); |
37 debug("Image2 name: " + image2.name); | 32 debug("Image2 name: " + image2.name); |
38 debug("Image2 description: " + image2.description + "<br>"); | 33 debug("Image2 description: " + image2.description + "<br>"); |
39 | 34 |
40 // Now do the same checks for ARIA type images. | 35 // Now do the same checks for ARIA type images. |
41 var image3 = imagesGroup.childAtIndex(1); | 36 var image3 = accessibilityController.accessibleElementById("img3"); |
42 debug("Image3 name: " + image3.name); | 37 debug("Image3 name: " + image3.name); |
43 debug("Image3 description: " + image3.description + "<br>"); | 38 debug("Image3 description: " + image3.description + "<br>"); |
44 | 39 |
45 // Now do the same checks for ARIA type images. | 40 // Now do the same checks for ARIA type images. |
46 var image4 = imagesGroup.childAtIndex(2); | 41 var image4 = accessibilityController.accessibleElementById("img4"); |
47 debug("Image4 name: " + image4.name); | 42 debug("Image4 name: " + image4.name); |
48 debug("Image4 description: " + image4.description + "<br>"); | 43 debug("Image4 description: " + image4.description + "<br>"); |
49 | 44 |
50 // Verify that the first image (with an empty alt tag) is ignored | 45 // Verify that the first image (with an empty alt tag) is ignored |
51 // by checking the children count of the group containing the native ima
ges == 2. | 46 shouldBe("accessibilityController.accessibleElementById('img-ignored')",
"undefined"); |
52 shouldBe("imagesGroup.childAtIndex(0).childrenCount", "2"); | |
53 } | 47 } |
54 | 48 |
55 </script> | 49 </script> |
56 | 50 |
57 </body> | 51 </body> |
58 </html> | 52 </html> |
OLD | NEW |