Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / ARIA-reflection.html
1 <!DOCTYPE html>
2 <html>
3 <body id="body">
4 <script src="../resources/js-test-pre.js"></script>
5 <div id="content">
6
7 <div id="test" data="some data">
8
9 </div>
10
11 <p id="description"></p>
12 <div id="console"></div>
13
14 <script>
15
16     description("This tests ARIA IDL Attribute Reflection.");
17
18     var element = document.getElementById("test");
19     var data = element.getAttribute("data");
20     var otherData = "other data";
21     var currentProperty;
22     var currentAttribute;
23
24     function testElement() {
25         currentAttribute = currentProperty.replace("aria", "aria-").toLowerCase();
26         
27         debug("\nTest " + currentProperty + " < - > " + currentAttribute);
28         shouldBeNull("element[currentProperty]");
29         shouldBeNull("element.getAttribute(currentAttribute)");
30         
31         // Set the property value
32         debug("element[\"" + currentProperty + "\"] = data;");
33         element[currentProperty] = data;
34         shouldBe("element.getAttribute(currentAttribute)", "data");
35
36         // Set the attribute value
37         debug("element.setAttribute(\"" + currentAttribute + "\", otherData);");
38         element.setAttribute(currentAttribute, otherData);
39         shouldBe("element[currentProperty]", "otherData");
40     }
41
42     function testRole() {
43         currentProperty = "role";
44         testElement();
45     }
46
47     if (window.accessibilityController) {
48
49         testRole();
50
51         // There are 46 ARIA attributes in total.
52         var count = 0;
53         for (var propertyName in element) {
54           if (propertyName.startsWith("aria")) {
55               currentProperty = propertyName;
56               testElement();
57               count++;
58           }
59         }
60
61         debug("\n");
62         shouldBe("count", "46");
63
64     } else {
65         testFailed("Could not load accessibility controller");
66     }
67
68 </script>
69
70 <script src="../resources/js-test-post.js"></script>
71 </body>
72 </html>