Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / help-text.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 id="examples">
10
11     <a class="ex" href="#" data-expected="">foo</a>
12     <a class="ex" href="#" title="bar" data-expected="bar">foo</a>
13     <a class="ex" href="#" title="bar" aria-help="baz" data-expected="baz">foo</a>
14     <a class="ex" href="#" title="foo" data-expected=""><!-- no contents, so @title used as label, not help --></a>
15     
16     <h1 class="ex" title="bar" data-expected="bar"><a class="ex" href="#" data-expected="">foo</a></h1>
17
18     <button class="ex" data-expected="">foo</button>
19     <button class="ex" title="bar" data-expected="bar">foo</button>
20     <button class="ex" title="bar" aria-help="baz" data-expected="baz">foo</button>
21     <button class="ex" title="foo" data-expected=""><!-- no contents, so @title used as label, not help --></button>
22
23     <table class="ex" summary="table summary" data-expected="table summary">
24         <caption class="ex" data-expected="">caption</caption>
25         <tr>
26             <td>
27                 <input class="ex" type="checkbox" data-expected="">
28                 <div class="ex" role="text" data-expected="">text</div>
29             </td>
30         </tr>
31     </table>
32
33     <main class="ex" aria-help="bar" data-expected="bar">
34         <button class="ex" data-expected="">foo</button>
35     </main>
36
37     <main class="ex" role="group" title="bar" data-expected="">
38         <div class="ex" role="group" data-expected="">foo</div>
39     </main>
40
41     <a href="" class="ex" title="bar" data-expected="bar">
42         <div class="ex" data-expected="">foo</div>
43     </a>
44
45 </div>
46
47 <p id="description"></p>
48 <div id="console"></div>
49
50 <script>
51
52     if (window.testRunner && window.accessibilityController) {
53
54         description("Tests accessibility help text in a variety of examples.");
55
56         var examples = document.querySelectorAll("#examples .ex");
57         for (var i = 0, c = examples.length; i < c; i++) {
58             var el = examples[i];
59             if (!el)
60                 continue;
61             var expectation = el.getAttribute("data-expected");
62             var id = el.id;
63             var tag = el.tagName.toLowerCase();
64             if (!id)
65                 el.id = id = "generatedId_" + i;
66             var ax = accessibilityController.accessibleElementById(id);
67             if (!ax)
68                 continue;
69             var output = platformValueForW3CDescription(ax);
70             var result = document.getElementById("console");
71             if (expectation === output)
72                 result.textContent += "PASS: Help text for <" + tag +"> is \"" + output + "\"\n";
73             else
74                 result.textContent += "FAIL: Help text for <" + tag +"> is \"" + output + "\" but expected \"" + expectation + "\"\n";
75         }
76
77         // Once tests are complete, hide all the example markup.
78         document.getElementById("examples").style.display = "none";
79
80     }
81
82 </script>
83
84 <script src="../resources/js-test-post.js"></script>
85 </body>
86 </html>