Merge "[Release] Webkit2-efl-123997_0.11.51" into tizen_2.1
[framework/web/webkit-efl.git] / LayoutTests / accessibility / canvas-accessibilitynodeobject.html
1 <!DOCTYPE HTML>
2 <html>
3 <body>
4 <script src="../fast/js/resources/js-test-pre.js"></script>
5
6 <div id="myContainer" tabindex="-1">
7   <a href="#">Link</a>
8   <button>Button</button>
9   <input type="text">
10   <input type="checkbox">
11   <input type="radio">
12   <input type="submit">
13   <select><option>1<option>2</select>
14   <span tabindex="0" role="button">ARIA button</span>
15   <span tabindex="0" role="link">ARIA link</span>
16 </div>
17
18 <canvas id="myCanvas" width="300" height="300" tabindex="-1">
19   <a href="#">Link</a>
20   <button>Button</button>
21   <input type="text">
22   <input type="checkbox">
23   <input type="radio">
24   <input type="submit">
25   <select><option>1<option>2</select>
26   <span tabindex="0" role="button">ARIA button</span>
27   <span tabindex="0" role="link">ARIA link</span>
28 </canvas>
29
30 <div id="console"></div>
31 <script>
32 description("This test makes sure that AccessibilityNodeObjects are created for elements in a canvas subtree.");
33
34 if (window.layoutTestController && window.accessibilityController) {
35     window.layoutTestController.dumpAsText();
36
37     function appendFocusableDescendants(axObject, axFocusableList) {
38         for (var i = 0; i < axObject.childrenCount; i++) {
39             var axChild = axObject.childAtIndex(i);
40             if (axChild.isFocusable)
41                 axFocusableList.push(axChild);
42             appendFocusableDescendants(axChild, axFocusableList);
43         }
44     }
45
46     var container = document.getElementById("myContainer");
47     container.focus();
48     var axContainer = accessibilityController.focusedElement;
49
50     var canvas = document.getElementById("myCanvas");
51     canvas.focus();
52     var axCanvas = accessibilityController.focusedElement;
53
54     var axRenderObjects = [];
55     var axNodeObjects = [];
56
57     appendFocusableDescendants(axContainer, axRenderObjects);
58     appendFocusableDescendants(axCanvas, axNodeObjects);
59
60     shouldBe("axRenderObjects.length", "axNodeObjects.length");
61
62     for (var i = 0; i < axRenderObjects.length; i++) {
63         var axRenderObject = axRenderObjects[i];
64         var axNodeObject = axNodeObjects[i];
65         shouldBe("i == " + i + "; axRenderObject.role == axNodeObject.role", "true");
66     }
67 }
68
69 </script>
70
71 <script src="../fast/js/resources/js-test-post.js"></script>
72 </body>
73 </html>