blob: e82d30f8cb98abe8a23a3f3fb2aa936380fc4446 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<details open id="details1">
<summary id="summary1">Some open info</summary>
<p>Details about the open topic.</p>
</details>
<details id="details2">
<summary>Some open info</summary>
<p>Details about the open topic.</p>
</details>
<details open id="details3" role="group">
<summary>Some open info</summary>
<p>Details about the open topic.</p>
</details>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests some basic attributes about the details element.");
var callbackCount = 0;
if (window.accessibilityController) {
window.jsTestIsAsync = true;
var body = accessibilityController.rootElement.childAtIndex(0);
body.addNotificationListener(function(notification) {
if (notification == "AXExpandedChanged") {
callbackCount++;
debug("Received " + notification + " notification ");
if (callbackCount == 2) {
finishJSTest();
}
}
});
var details1 = accessibilityController.accessibleElementById("details1");
var summary1 = accessibilityController.accessibleElementById("summary1");
shouldBe("details1.role", "'AXRole: AXGroup'");
shouldBe("details1.subrole", "'AXSubrole: AXDetails'");
shouldBeTrue("details1.isExpanded");
shouldBe("summary1.role", "'AXRole: AXButton'");
shouldBe("summary1.subrole", "'AXSubrole: AXSummary'");
shouldBe("summary1.title", "'AXTitle: Some open info'");
shouldBeTrue("details1.isAttributeSettable('AXExpanded')");
// Toggle the expanded state.
details1.setBoolAttributeValue("AXExpanded", false);
details1 = accessibilityController.accessibleElementById("details1");
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeFalse("details1.isExpanded");
shouldBeFalse("summary1.isExpanded");
// Give it the same value to make sure we don't expand.
details1.setBoolAttributeValue("AXExpanded", false);
details1 = accessibilityController.accessibleElementById("details1");
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeFalse("details1.isExpanded");
shouldBeFalse("summary1.isExpanded");
// Set to expand again.
details1.setBoolAttributeValue("AXExpanded", true);
details1 = accessibilityController.accessibleElementById("details1");
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeTrue("details1.isExpanded");
shouldBeTrue("summary1.isExpanded");
// And duplicate the true state to make sure it doesn't toggle off.
details1.setBoolAttributeValue("AXExpanded", true);
details1 = accessibilityController.accessibleElementById("details1");
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeTrue("details1.isExpanded");
shouldBeTrue("summary1.isExpanded");
var details2 = accessibilityController.accessibleElementById("details2");
shouldBe("details2.subrole", "'AXSubrole: AXDetails'");
shouldBeFalse("details2.isExpanded");
// Expanded status should be correct when detail has group role
var details3 = accessibilityController.accessibleElementById("details3");
shouldBe("details3.subrole", "'AXSubrole: AXApplicationGroup'");
shouldBeTrue("details3.isExpanded");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>