summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/accessibility/aria-hidden-updates-alldescendants.html
blob: b0557108e5f9134f0f39b130c960a54075d0fe0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">

<div>
        <h1 id="heading">Steps</h1>

        <main id="main" tabindex=0>
         test
                <div tabindex="-1" class="step-one" aria-hidden="true"><span>Step 1: Do something</span></div>
                <div tabindex="-1" class="step-two" aria-hidden="true"><span>Step 2: Do another thing</span></div>
                <div tabindex="-1" class="step-three" aria-hidden="true"><span>Step 3: Do one last thing</span></div>
        </main>

</div>


<p id="description"></p>
<div id="console"></div>

<script>

    description("This tests that if aria-hidden changes on an element, all it's existing children will update their children caches");

    if (window.accessibilityController) {
          document.getElementById("main").focus();
          
          var main = accessibilityController.focusedElement;
          // Access the element so the children cache is generated.
          main.childAtIndex(0);
          main.childAtIndex(1);
          shouldBe("main.childrenCount", "1");

          var group = document.getElementsByTagName('main')[0];
          var items = group.getElementsByTagName('div');          
          items[0].removeAttribute('aria-hidden');

          // After removing aria-hidden, the new count should be 2.
          shouldBe("main.childrenCount", "2");          
          
          // And most importantly, the DIV that was made non-hidden should have one child now.
          shouldBe("main.childAtIndex(1).childrenCount", "1");
    }

</script>

<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>