Title: [271453] trunk/LayoutTests
Revision
271453
Author
[email protected]
Date
2021-01-13 13:22:19 -0800 (Wed, 13 Jan 2021)

Log Message

Fix for LayoutTests/accessibility/mac/details-summary.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=220597

Reviewed by Chris Fleizach.

- Use Promises to wait for the expanded state change.
- Added a comment to clarify why it is necessary to fetch a new
accessible object by ID every time after setting the AXExpanded
attribute for <details> elements.

* accessibility/mac/details-summary-expected.txt:
The order in which the notifications come through changed.
* accessibility/mac/details-summary.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271452 => 271453)


--- trunk/LayoutTests/ChangeLog	2021-01-13 21:05:36 UTC (rev 271452)
+++ trunk/LayoutTests/ChangeLog	2021-01-13 21:22:19 UTC (rev 271453)
@@ -1,3 +1,19 @@
+2021-01-13  Andres Gonzalez  <[email protected]>
+
+        Fix for LayoutTests/accessibility/mac/details-summary.html in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=220597
+
+        Reviewed by Chris Fleizach.
+
+        - Use Promises to wait for the expanded state change.
+        - Added a comment to clarify why it is necessary to fetch a new
+        accessible object by ID every time after setting the AXExpanded
+        attribute for <details> elements.
+
+        * accessibility/mac/details-summary-expected.txt:
+        The order in which the notifications come through changed.
+        * accessibility/mac/details-summary.html:
+
 2021-01-13  Rob Buis  <[email protected]>
 
         Null check selector.argumentList()

Modified: trunk/LayoutTests/accessibility/mac/details-summary-expected.txt (271452 => 271453)


--- trunk/LayoutTests/accessibility/mac/details-summary-expected.txt	2021-01-13 21:05:36 UTC (rev 271452)
+++ trunk/LayoutTests/accessibility/mac/details-summary-expected.txt	2021-01-13 21:22:19 UTC (rev 271453)
@@ -17,10 +17,12 @@
 PASS summary1.subrole is 'AXSubrole: AXSummary'
 PASS summary1.title is 'AXTitle: Some open info'
 PASS details1.isAttributeSettable('AXExpanded') is true
+Received AXExpandedChanged notification
 PASS details1.isExpanded is false
 PASS summary1.isExpanded is false
 PASS details1.isExpanded is false
 PASS summary1.isExpanded is false
+Received AXExpandedChanged notification
 PASS details1.isExpanded is true
 PASS summary1.isExpanded is true
 PASS details1.isExpanded is true
@@ -29,8 +31,6 @@
 PASS details2.isExpanded is false
 PASS details3.subrole is 'AXSubrole: AXApplicationGroup'
 PASS details3.isExpanded is true
-Received AXExpandedChanged notification
-Received AXExpandedChanged notification
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/mac/details-summary.html (271452 => 271453)


--- trunk/LayoutTests/accessibility/mac/details-summary.html	2021-01-13 21:05:36 UTC (rev 271452)
+++ trunk/LayoutTests/accessibility/mac/details-summary.html	2021-01-13 21:22:19 UTC (rev 271453)
@@ -2,6 +2,7 @@
 <html>
 <head>
 <script src=""
+<script src=""
 </head>
 <body id="body">
 
@@ -24,23 +25,15 @@
 <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++;
+            if (notification == "AXExpandedChanged")
                 debug("Received " + notification + " notification ");
-
-                if (callbackCount == 2) {
-                   finishJSTest();
-                }
-            }
         });
 
         var details1 = accessibilityController.accessibleElementById("details1");
@@ -55,7 +48,15 @@
 
         // Toggle the expanded state.
         details1.setBoolAttributeValue("AXExpanded", false);
+
+        // After toggling the expanded state on a <details> element, the underlying HTMLDetailsElement goes away and it is replaced by a new object.
+        // Thus, we need to retrieve the corresponding accessible object again since the current one becomes defunct.
+        // See HTMLDetailsElement::toggleOpen().
+        setTimeout(async function() {
+            await waitFor(() => {
         details1 = accessibilityController.accessibleElementById("details1");
+                return !details1.isExpanded;
+            });
         summary1 = accessibilityController.accessibleElementById("summary1");
         shouldBeFalse("details1.isExpanded");
         shouldBeFalse("summary1.isExpanded");
@@ -62,7 +63,10 @@
 
         // 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;
+            });
         summary1 = accessibilityController.accessibleElementById("summary1");
         shouldBeFalse("details1.isExpanded");
         shouldBeFalse("summary1.isExpanded");
@@ -69,7 +73,10 @@
 
         // Set to expand again.
         details1.setBoolAttributeValue("AXExpanded", true);
+            await waitFor(() => {
         details1 = accessibilityController.accessibleElementById("details1");
+                return details1.isExpanded;
+            });
         summary1 = accessibilityController.accessibleElementById("summary1");
         shouldBeTrue("details1.isExpanded");
         shouldBeTrue("summary1.isExpanded");
@@ -76,23 +83,27 @@
 
         // 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;
+            });
         summary1 = accessibilityController.accessibleElementById("summary1");
         shouldBeTrue("details1.isExpanded");
         shouldBeTrue("summary1.isExpanded");
 
-        var details2 = accessibilityController.accessibleElementById("details2");
+            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");
+            details3 = accessibilityController.accessibleElementById("details3");
         shouldBe("details3.subrole", "'AXSubrole: AXApplicationGroup'");
         shouldBeTrue("details3.isExpanded");
+
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
 <script src=""
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to