blob: 470d01e39d72d2aa92aa2f2f70860778af706f53 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<ruby id="rubyElemId">
<rb>basetext</rb>
<rp>(</rp>
<rt>rubytext</rt>
<rp>)</rp>
</ruby>
<script>
if (window.accessibilityController) {
description("This tests that the ruby containers are exposed with the appropriate hierarchy and roles.")
// At the moment, this is implemented only for OSX.
var platform = accessibilityController.platformName;
if ("mac" == platform) {
// Expected values for roles and subroles.
var expectedRubyRole = "AXRole: AXGroup"; // all ruby containers have AXGroup role
var expectedRubyInlineSubrole = "AXSubrole: AXRubyInline";
var expectedRubyBlockSubrole = "AXSubrole: AXRubyBlock";
var expectedRubyRunSubrole = "AXSubrole: AXRubyRun";
var expectedRubyTextSubrole = "AXSubrole: AXRubyText";
var expectedRubyBaseSubrole = "AXSubrole: AXRubyBase";
// Try inline style first, block style second
var rubyElem = document.getElementById("rubyElemId");
shouldBeTrue("rubyElem != null");
rubyElem.style.display = "inline";
checkHierarchyAndRoles(rubyElem);
rubyElem.style.display = "block";
checkHierarchyAndRoles(rubyElem);
function checkHierarchyAndRoles(rubyElem) {
axRuby = window.accessibilityController.accessibleElementById("rubyElemId");
shouldBeTrue("axRuby != null");
role = axRuby.role;
subrole = axRuby.subrole;
shouldBe("role", "expectedRubyRole");
if (rubyElem.style.display == "inline") {
shouldBe("subrole", "expectedRubyInlineSubrole");
}
else {
shouldBe("subrole", "expectedRubyBlockSubrole");
}
// RubyRun
axRubyRun = axRuby.childAtIndex(0);
shouldBeTrue("axRubyRun != null");
role = axRubyRun.role;
subrole = axRubyRun.subrole;
shouldBe("role", "expectedRubyRole");
shouldBe("subrole", "expectedRubyRunSubrole");
// RubyText
axRubyText = axRubyRun.childAtIndex(0);
shouldBeTrue("axRubyText != null");
role = axRubyText.role;
subrole = axRubyText.subrole;
shouldBe("role", "expectedRubyRole");
shouldBe("subrole", "expectedRubyTextSubrole");
// RubyBase
axRubyBase = axRubyRun.childAtIndex(1);
shouldBeTrue("axRubyBase != null");
role = axRubyBase.role;
subrole = axRubyBase.subrole;
shouldBe("role", "expectedRubyRole");
shouldBe("subrole", "expectedRubyBaseSubrole");
}
}
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>