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");
shouldBe("details1.role", "'AXRole: AXGroup'");
shouldBeTrue("details1.isExpanded");
shouldBe("details1.childAtIndex(0).role", "'AXRole: AXGroup'");
shouldBe("details1.childAtIndex(0).subrole", "'AXSubrole: AXSummary'");
+ shouldBeTrue("details1.isAttributeSettable('AXExpanded')");
+
+ // Toggle the expanded state.
+ details1.setBoolAttributeValue("AXExpanded", false);
+ details1 = accessibilityController.accessibleElementById("details1");
+ shouldBeFalse("details1.isExpanded");
+
+ // Give it the same value to make sure we don't expand.
+ details1.setBoolAttributeValue("AXExpanded", false);
+ details1 = accessibilityController.accessibleElementById("details1");
+ shouldBeFalse("details1.isExpanded");
+
+ // Set to expand again.
+ details1.setBoolAttributeValue("AXExpanded", true);
+ details1 = accessibilityController.accessibleElementById("details1");
+ shouldBeTrue("details1.isExpanded");
+
+ // And duplicate the true state to make sure it doesn't toggle off.
+ details1.setBoolAttributeValue("AXExpanded", true);
+ details1 = accessibilityController.accessibleElementById("details1");
+ shouldBeTrue("details1.isExpanded");
var details2 = accessibilityController.accessibleElementById("details2");
shouldBe("details2.subrole", "'AXSubrole: AXDetails'");