⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271453 in webkit


Ignore:
Timestamp:
Jan 13, 2021, 1:22:19 PM (6 years ago)
Author:
Andres Gonzalez
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:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271451 r271453  
     12021-01-13  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for LayoutTests/accessibility/mac/details-summary.html in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=220597
     5
     6        Reviewed by Chris Fleizach.
     7
     8        - Use Promises to wait for the expanded state change.
     9        - Added a comment to clarify why it is necessary to fetch a new
     10        accessible object by ID every time after setting the AXExpanded
     11        attribute for <details> elements.
     12
     13        * accessibility/mac/details-summary-expected.txt:
     14        The order in which the notifications come through changed.
     15        * accessibility/mac/details-summary.html:
     16
    1172021-01-13  Rob Buis  <rbuis@igalia.com>
    218
  • trunk/LayoutTests/accessibility/mac/details-summary-expected.txt

    r267644 r271453  
    1818PASS summary1.title is 'AXTitle: Some open info'
    1919PASS details1.isAttributeSettable('AXExpanded') is true
     20Received AXExpandedChanged notification
    2021PASS details1.isExpanded is false
    2122PASS summary1.isExpanded is false
    2223PASS details1.isExpanded is false
    2324PASS summary1.isExpanded is false
     25Received AXExpandedChanged notification
    2426PASS details1.isExpanded is true
    2527PASS summary1.isExpanded is true
     
    3032PASS details3.subrole is 'AXSubrole: AXApplicationGroup'
    3133PASS details3.isExpanded is true
    32 Received AXExpandedChanged notification
    33 Received AXExpandedChanged notification
    3434PASS successfullyParsed is true
    3535
  • trunk/LayoutTests/accessibility/mac/details-summary.html

    r232285 r271453  
    33<head>
    44<script src="../../resources/js-test-pre.js"></script>
     5<script src="../../resources/accessibility-helper.js"></script>
    56</head>
    67<body id="body">
     
    2526
    2627<script>
    27 
    2828    description("This tests some basic attributes about the details element.");
    2929
    30     var callbackCount = 0;
    3130    if (window.accessibilityController) {
    3231        window.jsTestIsAsync = true;
     
    3433        var body = accessibilityController.rootElement.childAtIndex(0);
    3534        body.addNotificationListener(function(notification) {
    36             if (notification == "AXExpandedChanged") {
    37                 callbackCount++;
     35            if (notification == "AXExpandedChanged")
    3836                debug("Received " + notification + " notification ");
    39 
    40                 if (callbackCount == 2) {
    41                    finishJSTest();
    42                 }
    43             }
    4437        });
    4538
     
    5649        // Toggle the expanded state.
    5750        details1.setBoolAttributeValue("AXExpanded", false);
     51
     52        // After toggling the expanded state on a <details> element, the underlying HTMLDetailsElement goes away and it is replaced by a new object.
     53        // Thus, we need to retrieve the corresponding accessible object again since the current one becomes defunct.
     54        // See HTMLDetailsElement::toggleOpen().
     55        setTimeout(async function() {
     56            await waitFor(() => {
    5857        details1 = accessibilityController.accessibleElementById("details1");
     58                return !details1.isExpanded;
     59            });
    5960        summary1 = accessibilityController.accessibleElementById("summary1");
    6061        shouldBeFalse("details1.isExpanded");
     
    6364        // Give it the same value to make sure we don't expand.
    6465        details1.setBoolAttributeValue("AXExpanded", false);
     66            await waitFor(() => {
    6567        details1 = accessibilityController.accessibleElementById("details1");
     68                return !details1.isExpanded;
     69            });
    6670        summary1 = accessibilityController.accessibleElementById("summary1");
    6771        shouldBeFalse("details1.isExpanded");
     
    7074        // Set to expand again.
    7175        details1.setBoolAttributeValue("AXExpanded", true);
     76            await waitFor(() => {
    7277        details1 = accessibilityController.accessibleElementById("details1");
     78                return details1.isExpanded;
     79            });
    7380        summary1 = accessibilityController.accessibleElementById("summary1");
    7481        shouldBeTrue("details1.isExpanded");
     
    7784        // And duplicate the true state to make sure it doesn't toggle off.
    7885        details1.setBoolAttributeValue("AXExpanded", true);
     86            await waitFor(() => {
    7987        details1 = accessibilityController.accessibleElementById("details1");
     88                return details1.isExpanded;
     89            });
    8090        summary1 = accessibilityController.accessibleElementById("summary1");
    8191        shouldBeTrue("details1.isExpanded");
    8292        shouldBeTrue("summary1.isExpanded");
    8393
    84         var details2 = accessibilityController.accessibleElementById("details2");
     94            details2 = accessibilityController.accessibleElementById("details2");
    8595        shouldBe("details2.subrole", "'AXSubrole: AXDetails'");
    8696        shouldBeFalse("details2.isExpanded");
    8797
    8898        // Expanded status should be correct when detail has group role
    89         var details3 = accessibilityController.accessibleElementById("details3");
     99            details3 = accessibilityController.accessibleElementById("details3");
    90100        shouldBe("details3.subrole", "'AXSubrole: AXApplicationGroup'");
    91101        shouldBeTrue("details3.isExpanded");
     102
     103            finishJSTest();
     104        }, 0);
    92105    }
    93 
    94106</script>
    95 
    96107<script src="../../resources/js-test-post.js"></script>
    97108</body>
Note: See TracChangeset for help on using the changeset viewer.