Skip to content
Permalink
Browse files
AX ITM: Fix for accessibility/mac/details-summary.html in isolated tr…
…ee mode.

https://bugs.webkit.org/show_bug.cgi?id=241804

Reviewed by Darin Adler.

Need to check for null the accessible object in the waitFor function before calling isExpanded. Also buffering the output in a variable makes the test run faster.

* LayoutTests/accessibility/mac/details-summary-expected.txt:
* LayoutTests/accessibility/mac/details-summary.html:

Canonical link: https://commits.webkit.org/251725@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
AndresGonzalezApple committed Jun 22, 2022
1 parent 79efdcf commit 3b7a0aa899f3a2962f6bcb9a74e7a653fd462e6e
Showing 2 changed files with 66 additions and 75 deletions.
@@ -1,37 +1,28 @@
Some open info
Details about the open topic.

Some open info
Some open info
Details about the open topic.

This tests some basic attributes about the details element.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS details1.role is 'AXRole: AXGroup'
PASS details1.subrole is 'AXSubrole: AXDetails'
PASS details1.isExpanded is true
PASS summary1.role is 'AXRole: AXButton'
PASS summary1.subrole is 'AXSubrole: AXSummary'
PASS summary1.title is 'AXTitle: Some open info'
PASS details1.isAttributeSettable('AXExpanded') is true
PASS: details1.role === 'AXRole: AXGroup'
PASS: details1.subrole === 'AXSubrole: AXDetails'
PASS: details1.isExpanded === true
PASS: summary1.role === 'AXRole: AXButton'
PASS: summary1.subrole === 'AXSubrole: AXSummary'
PASS: summary1.title === 'AXTitle: Some open info'
PASS: details1.isAttributeSettable('AXExpanded') === true
Received AXExpandedChanged notification
PASS details1.isExpanded is false
PASS summary1.isExpanded is false
PASS details1.isExpanded is false
PASS summary1.isExpanded is false
PASS: details1.isExpanded === false
PASS: summary1.isExpanded === false
PASS: details1.isExpanded === false
PASS: summary1.isExpanded === false
Received AXExpandedChanged notification
PASS details1.isExpanded is true
PASS summary1.isExpanded is true
PASS details1.isExpanded is true
PASS summary1.isExpanded is true
PASS details2.subrole is 'AXSubrole: AXDetails'
PASS details2.isExpanded is false
PASS details3.subrole is 'AXSubrole: AXApplicationGroup'
PASS details3.isExpanded is true
PASS: details1.isExpanded === true
PASS: summary1.isExpanded === true
PASS: details1.isExpanded === true
PASS: summary1.isExpanded === true
PASS: details2.subrole === 'AXSubrole: AXDetails'
PASS: details2.isExpanded === false
PASS: details3.subrole === 'AXSubrole: AXApplicationGroup'
PASS: details3.isExpanded === true

PASS successfullyParsed is true

TEST COMPLETE


@@ -1,11 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
</head>
<body id="body">

<div id="content">
<details open id="details1">
<summary id="summary1">Some open info</summary>
<p>Details about the open topic.</p>
@@ -20,31 +21,29 @@
<summary>Some open info</summary>
<p>Details about the open topic.</p>
</details>

<p id="description"></p>
<div id="console"></div>
</div>

<script>
description("This tests some basic attributes about the details element.");
var output = "This tests some basic attributes about the details element.\n";

if (window.accessibilityController) {
window.jsTestIsAsync = true;

var body = accessibilityController.rootElement.childAtIndex(0);
body.addNotificationListener(function(notification) {
if (notification == "AXExpandedChanged")
debug("Received " + notification + " notification ");
output += `Received ${notification} notification\n`;
});

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')");
output += expect("details1.role", "'AXRole: AXGroup'");
output += expect("details1.subrole", "'AXSubrole: AXDetails'");
output += expect("details1.isExpanded", "true");
output += expect("summary1.role", "'AXRole: AXButton'");
output += expect("summary1.subrole", "'AXSubrole: AXSummary'");
output += expect("summary1.title", "'AXTitle: Some open info'");
output += expect("details1.isAttributeSettable('AXExpanded')", "true");

// Toggle the expanded state.
details1.setBoolAttributeValue("AXExpanded", false);
@@ -54,56 +53,57 @@
// See HTMLDetailsElement::toggleOpen().
setTimeout(async function() {
await waitFor(() => {
details1 = accessibilityController.accessibleElementById("details1");
return !details1.isExpanded;
details1 = accessibilityController.accessibleElementById("details1");
return details1 && !details1.isExpanded;
});
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeFalse("details1.isExpanded");
shouldBeFalse("summary1.isExpanded");
summary1 = accessibilityController.accessibleElementById("summary1");
output += expect("details1.isExpanded", "false");
output += expect("summary1.isExpanded", "false");

// Give it the same value to make sure we don't expand.
details1.setBoolAttributeValue("AXExpanded", false);
// Give it the same value to make sure we don't expand.
details1.setBoolAttributeValue("AXExpanded", false);
await waitFor(() => {
details1 = accessibilityController.accessibleElementById("details1");
return !details1.isExpanded;
details1 = accessibilityController.accessibleElementById("details1");
return details1 && !details1.isExpanded;
});
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeFalse("details1.isExpanded");
shouldBeFalse("summary1.isExpanded");
summary1 = accessibilityController.accessibleElementById("summary1");
output += expect("details1.isExpanded", "false");
output += expect("summary1.isExpanded", "false");

// Set to expand again.
details1.setBoolAttributeValue("AXExpanded", true);
// Set to expand again.
details1.setBoolAttributeValue("AXExpanded", true);
await waitFor(() => {
details1 = accessibilityController.accessibleElementById("details1");
return details1.isExpanded;
details1 = accessibilityController.accessibleElementById("details1");
return details1 && details1.isExpanded;
});
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeTrue("details1.isExpanded");
shouldBeTrue("summary1.isExpanded");
summary1 = accessibilityController.accessibleElementById("summary1");
output += expect("details1.isExpanded", "true");
output += expect("summary1.isExpanded", "true");

// And duplicate the true state to make sure it doesn't toggle off.
details1.setBoolAttributeValue("AXExpanded", true);
// And duplicate the true state to make sure it doesn't toggle off.
details1.setBoolAttributeValue("AXExpanded", true);
await waitFor(() => {
details1 = accessibilityController.accessibleElementById("details1");
return details1.isExpanded;
details1 = accessibilityController.accessibleElementById("details1");
return details1 && details1.isExpanded;
});
summary1 = accessibilityController.accessibleElementById("summary1");
shouldBeTrue("details1.isExpanded");
shouldBeTrue("summary1.isExpanded");
summary1 = accessibilityController.accessibleElementById("summary1");
output += expect("details1.isExpanded", "true");
output += expect("summary1.isExpanded", "true");

details2 = accessibilityController.accessibleElementById("details2");
shouldBe("details2.subrole", "'AXSubrole: AXDetails'");
shouldBeFalse("details2.isExpanded");
output += expect("details2.subrole", "'AXSubrole: AXDetails'");
output += expect("details2.isExpanded", "false");

// Expanded status should be correct when detail has group role
// Expanded status should be correct when detail has group role
details3 = accessibilityController.accessibleElementById("details3");
shouldBe("details3.subrole", "'AXSubrole: AXApplicationGroup'");
shouldBeTrue("details3.isExpanded");
output += expect("details3.subrole", "'AXSubrole: AXApplicationGroup'");
output += expect("details3.isExpanded", "true");

debug(output);
document.getElementById("content").style.visibility = "hidden";
finishJSTest();
}, 0);
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

0 comments on commit 3b7a0aa

Please sign in to comment.