Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / aria-hidden-update.html
1 <html>
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 </head>
6 <body id="body">
7  
8     <div role="group" tabindex="0" id="parent">
9     <div role="button" id="button1" tabindex="0">Button 1</div>
10     <div role="button" id="button2" tabindex="0">Button 2</div>
11     <div role="button" id="button3" tabindex="0">Button 3</div>
12
13     </div>
14
15
16     <p id="description"></p>
17     <div id="console"></div>
18      
19     <script>
20         if (window.accessibilityController) {
21             jsTestIsAsync = true;
22             description("This test makes sure that when aria-hidden changes, the AX hierarchy is updated.");
23
24             // Get the parent element.
25             document.getElementById("parent").focus();
26             var parent = accessibilityController.focusedElement;
27             
28             // Get all three children.
29             document.getElementById("button1").focus();
30             var button1 = accessibilityController.focusedElement;
31             document.getElementById("button2").focus();
32             var button2 = accessibilityController.focusedElement;
33             document.getElementById("button3").focus();
34             var button3 = accessibilityController.focusedElement;
35       
36             // Verify that the 3 children are present.
37             shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
38             shouldBeTrue("parent.childAtIndex(1).isEqual(button2)");
39             shouldBeTrue("parent.childAtIndex(2).isEqual(button3)");
40
41             // Make the 2nd button hidden. Only 1 and 3 should be present.
42             document.getElementById("button2").setAttribute("aria-hidden", "true");
43             setTimeout(function() {
44                 shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
45                 shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
46            
47                 // Make the 1st button hidden. Only 3 should be present.
48                 document.getElementById("button1").setAttribute("aria-hidden", "true");
49                 setTimeout(function() {
50                     shouldBeTrue("parent.childAtIndex(0).isEqual(button3)");
51
52                     // Make the 2nd button not hidden. 2 and 3 should be present.
53                     document.getElementById("button2").setAttribute("aria-hidden", "false");
54                     setTimeout(function() {
55                         shouldBeTrue("parent.childAtIndex(0).isEqual(button2)");
56                         shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
57                         finishJSTest();
58                     }, 0);
59                 }, 0);
60             }, 0);
61         }
62     </script>
63
64 <script src="../resources/js-test-post.js"></script>
65 </body>
66 </html>