| <!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> |
| |
| <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"); |
| } |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |