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