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