Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / img-fallsback-to-title.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 <script src="../resources/accessibility-helper.js"></script>
6 </head>
7 <body id="body">
8
9 <div role="group" tabindex="0" id="images">
10     <img alt="" height="100" width="100">
11     <img title="test1" height="100" width="100">
12     <img alt="alt" title="test2" height="100" width="100">
13     <div role="img" title="test3" width="100" height="100">test</div>
14     <div role="img" alt="alt" title="test4" width="100" height="100">test</div>
15 </div>
16
17 <p id="description"></p>
18 <div id="console"></div>
19
20 <script>
21
22     description("This tests that images will fallback to using the title attribute if no other descriptive text is present.");
23
24     if (window.accessibilityController) {
25
26         document.getElementById("images").focus();
27         var imagesGroup = accessibilityController.focusedElement;
28
29         // First image should have a description of "test1" because there is no alt tag (it should use the title).
30         // The title should NOT be in the help text.
31         var image1 = imagesGroup.childAtIndex(0).childAtIndex(0);
32         debug("Image1:");
33         debug(platformTextAlternatives(image1));
34
35         // Second image should use the description from the alt tag instead of the title.
36         // The help text should reflect what's in the title.
37         var image2 = imagesGroup.childAtIndex(0).childAtIndex(1);
38         debug("Image2:");
39         debug(platformTextAlternatives(image2));
40
41         // Now do the same checks for ARIA type images.
42         var image3 = imagesGroup.childAtIndex(1);
43         debug("Image3:");
44         debug(platformTextAlternatives(image3));
45
46         // Now do the same checks for ARIA type images.
47         var image4 = imagesGroup.childAtIndex(2);
48         debug("Image4:");
49         debug(platformTextAlternatives(image4));
50
51         // Verify that the first image (with an empty alt tag) is ignored
52         // by checking the children count of the group containing the native images == 2.
53         shouldBe("imagesGroup.childAtIndex(0).childrenCount", "2");
54     }
55
56 </script>
57
58 <script src="../resources/js-test-post.js"></script>
59 </body>
60 </html>