064057dbf9434c554a6f0359a01d4a8bcc838669
[WebKit-https.git] / LayoutTests / accessibility / aria-hidden-updates-alldescendants.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
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>
13         <h1 id="heading">Steps</h1>
14
15         <main id="main" tabindex=0>
16          test
17                 <div tabindex="-1" class="step-one" aria-hidden="true"><span>Step 1: Do something</span></div>
18                 <div tabindex="-1" class="step-two" aria-hidden="true"><span>Step 2: Do another thing</span></div>
19                 <div tabindex="-1" class="step-three" aria-hidden="true"><span>Step 3: Do one last thing</span></div>
20         </main>
21
22 </div>
23
24
25 <p id="description"></p>
26 <div id="console"></div>
27
28 <script>
29
30     description("This tests that if aria-hidden changes on an element, all it's existing children will update their children caches");
31
32     if (window.accessibilityController) {
33           document.getElementById("main").focus();
34           
35           var main = accessibilityController.focusedElement;
36           // Access the element so the children cache is generated.
37           main.childAtIndex(0);
38           main.childAtIndex(1);
39           shouldBe("main.childrenCount", "1");
40
41           var group = document.getElementsByTagName('main')[0];
42           var items = group.getElementsByTagName('div');          
43           items[0].removeAttribute('aria-hidden');
44
45           // After removing aria-hidden, the new count should be 2.
46           shouldBe("main.childrenCount", "2");          
47           
48           // And most importantly, the DIV that was made non-hidden should have one child now.
49           shouldBe("main.childAtIndex(1).childrenCount", "1");
50     }
51
52     successfullyParsed = true;
53 </script>
54
55 <script src="../fast/js/resources/js-test-post.js"></script>
56 </body>
57 </html>