1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <ruby id="rubyElemId">
8 <rb>basetext</rb>
9 <rp>(</rp>
10 <rt>rubytext</rt>
11 <rp>)</rp>
12 </ruby>
13
14 <script>
15 if (window.accessibilityController) {
16 description("This tests that the ruby containers are exposed with the appropriate hierarchy and roles.")
17 // At the moment, this is implemented only for OSX.
18 var platform = accessibilityController.platformName;
19 if ("mac" == platform) {
20 // Expected values for roles and subroles.
21 var expectedRubyRole = "AXRole: AXGroup"; // all ruby containers have AXGroup role
22 var expectedRubyInlineSubrole = "AXSubrole: AXRubyInline";
23 var expectedRubyBlockSubrole = "AXSubrole: AXRubyBlock";
24 var expectedRubyRunSubrole = "AXSubrole: AXRubyRun";
25 var expectedRubyTextSubrole = "AXSubrole: AXRubyText";
26 var expectedRubyBaseSubrole = "AXSubrole: AXRubyBase";
27
28 // Try inline style first, block style second
29 var rubyElem = document.getElementById("rubyElemId");
30 shouldBeTrue("rubyElem != null");
31 rubyElem.style.display = "inline";
32 checkHierarchyAndRoles(rubyElem);
33
34 rubyElem.style.display = "block";
35 checkHierarchyAndRoles(rubyElem);
36
37 function checkHierarchyAndRoles(rubyElem) {
38 axRuby = window.accessibilityController.accessibleElementById("rubyElemId");
39 shouldBeTrue("axRuby != null");
40 role = axRuby.role;
41 subrole = axRuby.subrole;
42 shouldBe("role", "expectedRubyRole");
43 if (rubyElem.style.display == "inline") {
44 shouldBe("subrole", "expectedRubyInlineSubrole");
45 }
46 else {
47 shouldBe("subrole", "expectedRubyBlockSubrole");
48 }
49
50 // RubyRun
51 axRubyRun = axRuby.childAtIndex(0);
52 shouldBeTrue("axRubyRun != null");
53 role = axRubyRun.role;
54 subrole = axRubyRun.subrole;
55 shouldBe("role", "expectedRubyRole");
56 shouldBe("subrole", "expectedRubyRunSubrole");
57
58 // RubyText
59 axRubyText = axRubyRun.childAtIndex(0);
60 shouldBeTrue("axRubyText != null");
61 role = axRubyText.role;
62 subrole = axRubyText.subrole;
63 shouldBe("role", "expectedRubyRole");
64 shouldBe("subrole", "expectedRubyTextSubrole");
65
66 // RubyBase
67 axRubyBase = axRubyRun.childAtIndex(1);
68 shouldBeTrue("axRubyBase != null");
69 role = axRubyBase.role;
70 subrole = axRubyBase.subrole;
71 shouldBe("role", "expectedRubyRole");
72 shouldBe("subrole", "expectedRubyBaseSubrole");
73 }
74 }
75 }
76 </script>
77 <script src="../resources/js-test-post.js"></script>
78 </body>
79</html>