Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / img-fallsback-to-title.html
blob1de678f773592875ec58a565458164a84fe9fdfd
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 </head>
6 <body id="body">
8 <div role="group" tabindex="0" id="images">
9 <img alt="" height="100" width="100">
10 <img title="test1" height="100" width="100">
11 <img alt="alt" title="test2" height="100" width="100">
12 <div role="img" title="test3" width="100" height="100">test</div>
13 <div role="img" alt="alt" title="test4" width="100" height="100">test</div>
14 </div>
16 <p id="description"></p>
17 <div id="console"></div>
19 <script>
21 description("This tests that images will fallback to using the title attribute if no other descriptive text is present.");
23 if (window.accessibilityController) {
25 document.getElementById("images").focus();
26 var imagesGroup = accessibilityController.focusedElement;
28 // 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 help text.
30 var image1 = imagesGroup.childAtIndex(0).childAtIndex(0);
31 debug("Image1 description: " + image1.deprecatedDescription);
32 debug("Image1 help: " + image1.deprecatedHelpText + "<br>");
34 // Second image should use the description from the alt tag instead of the title.
35 // The help text should reflect what's in the title.
36 var image2 = imagesGroup.childAtIndex(0).childAtIndex(1);
37 debug("Image2 description: " + image2.deprecatedDescription);
38 debug("Image2 help: " + image2.deprecatedHelpText + "<br>");
40 // Now do the same checks for ARIA type images.
41 var image3 = imagesGroup.childAtIndex(1);
42 debug("Image3 description: " + image3.deprecatedDescription);
43 debug("Image3 help: " + image3.deprecatedHelpText + "<br>");
45 // Now do the same checks for ARIA type images.
46 var image4 = imagesGroup.childAtIndex(2);
47 debug("Image4 description: " + image4.deprecatedDescription);
48 debug("Image4 help: " + image4.deprecatedHelpText + "<br>");
50 // Verify that the first image (with an empty alt tag) is ignored
51 // by checking the children count of the group containing the native images == 2.
52 shouldBe("imagesGroup.childAtIndex(0).childrenCount", "2");
55 </script>
57 </body>
58 </html>