0083335fae5c090e9f2a2fd113f3f4a7c7f7cf16
[WebKit-https.git] / LayoutTests / accessibility / inline-continuations.html
1 <!DOCTYPE html>
2 <head>
3 <title>Inline continuations - accessibility tree linkage</title>
4 <script src="../fast/js/resources/js-test-pre.js"></script>
5 <script>
6 if (window.layoutTestController)
7     layoutTestController.dumpAsText();
8 var successfullyParsed = false;
9 </script>
10 </head>
11 <body>
12
13 <h2>Inline continuations - accessibility tree linkage</h2>
14
15 <p>This test checks that the right accessibility tree is generated in
16    the presence of inline continuations. Each of the five numbers
17    below should be visited only ones traversing the accessibility
18    tree.</p>
19
20 <div contentEditable="true" id="test"><span>1<div>2</div>3</span><span>4</span><div>5</div></div>
21
22 <div id="console"></div>
23
24 <script>
25 function nonGroupDescendants(elt)
26 {
27     var result = 0;
28     var count = elt.childrenCount;
29     for (var i = 0; i < count; ++i) {
30         var child = elt.childAtIndex(i);
31           if (!child.role.match(/group/i))
32           result++;
33         result += nonGroupDescendants(child);
34     }
35     return result;
36 }
37
38 if (window.accessibilityController) {
39     var result = document.getElementById("result");
40     document.getElementById("test").focus();
41     shouldBe("nonGroupDescendants(accessibilityController.focusedElement)", "5");
42
43     // This should pass (and is a simpler test than above) if anonymous blocks were not in the AX tree
44     // shouldBe("accessibilityController.focusedElement.childrenCount", "5");
45 }
46
47
48 var successfullyParsed = true;
49 </script>
50
51 <script src="../fast/js/resources/js-test-post.js"></script>
52 </body>