Title: [286948] trunk/LayoutTests
Revision
286948
Author
tyle...@apple.com
Date
2021-12-13 08:20:39 -0800 (Mon, 13 Dec 2021)

Log Message

AX: Make aria-hidden-update.html, focusable-div.html, mac/invalid-status-for-input-types.html, and mac/css-speech-speak.html pass in --release isolated tree mode
https://bugs.webkit.org/show_bug.cgi?id=234198

Reviewed by Chris Fleizach.

Make the following tests async or otherwise isolated-tree friendly
(i.e. by using accessibleElementById instead of document.getElementById().focus() +
accessibilityController.focusedElement to get a JS reference to an AX object).

* accessibility/aria-hidden-update-expected.txt:
* accessibility/aria-hidden-update.html:
* accessibility/focusable-div-expected.txt:
* accessibility/focusable-div.html:
* accessibility/mac/invalid-status-for-input-types-expected.txt:
* accessibility/mac/invalid-status-for-input-types.html:
Make these tests async. These tests must be async to pass in isolated
tree mode because they use JS to dynamically change the page.
* accessibility/mac/css-speech-speak-expected.txt:
* accessibility/mac/css-speech-speak.html:
Use accessibleElementById instead of document.getElementById().focus() +
accessibilityController.focusedElement to get references to JS AX objects.

* platform/glib/TestExpectations:
* platform/win/TestExpectations:
Skip accessibility/focusable-div.html due to lack of
AccessibilityUIElement::domIdentifier implementation.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (286947 => 286948)


--- trunk/LayoutTests/ChangeLog	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/ChangeLog	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1,3 +1,32 @@
+2021-12-13  Tyler Wilcock  <tyle...@apple.com>
+
+        AX: Make aria-hidden-update.html, focusable-div.html, mac/invalid-status-for-input-types.html, and mac/css-speech-speak.html pass in --release isolated tree mode
+        https://bugs.webkit.org/show_bug.cgi?id=234198
+
+        Reviewed by Chris Fleizach.
+
+        Make the following tests async or otherwise isolated-tree friendly
+        (i.e. by using accessibleElementById instead of document.getElementById().focus() +
+        accessibilityController.focusedElement to get a JS reference to an AX object).
+
+        * accessibility/aria-hidden-update-expected.txt:
+        * accessibility/aria-hidden-update.html:
+        * accessibility/focusable-div-expected.txt:
+        * accessibility/focusable-div.html:
+        * accessibility/mac/invalid-status-for-input-types-expected.txt:
+        * accessibility/mac/invalid-status-for-input-types.html:
+        Make these tests async. These tests must be async to pass in isolated
+        tree mode because they use JS to dynamically change the page.
+        * accessibility/mac/css-speech-speak-expected.txt:
+        * accessibility/mac/css-speech-speak.html:
+        Use accessibleElementById instead of document.getElementById().focus() +
+        accessibilityController.focusedElement to get references to JS AX objects.
+
+        * platform/glib/TestExpectations:
+        * platform/win/TestExpectations:
+        Skip accessibility/focusable-div.html due to lack of
+        AccessibilityUIElement::domIdentifier implementation.
+
 2021-12-13  Youenn Fablet  <you...@apple.com>
 
         Fix ServiceWorker downloads

Modified: trunk/LayoutTests/accessibility/aria-hidden-update-expected.txt (286947 => 286948)


--- trunk/LayoutTests/accessibility/aria-hidden-update-expected.txt	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/aria-hidden-update-expected.txt	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1,20 +1,19 @@
-Button 1
-Button 2
-Button 3
 This test makes sure that when aria-hidden changes, the AX hierarchy is updated.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS parent.childAtIndex(0).isEqual(button1) is true
-PASS parent.childAtIndex(1).isEqual(button2) is true
-PASS parent.childAtIndex(2).isEqual(button3) is true
-PASS parent.childAtIndex(0).isEqual(button1) is true
-PASS parent.childAtIndex(1).isEqual(button3) is true
-PASS parent.childAtIndex(0).isEqual(button3) is true
-PASS parent.childAtIndex(0).isEqual(button2) is true
-PASS parent.childAtIndex(1).isEqual(button3) is true
+PASS container.childAtIndex(0).isEqual(button1) is true
+PASS container.childAtIndex(1).isEqual(button2) is true
+PASS container.childAtIndex(2).isEqual(button3) is true
+PASS container.childAtIndex(0).isEqual(button1) is true
+PASS container.childAtIndex(1).isEqual(button3) === true
+PASS container.childAtIndex(0).isEqual(button3) === true
+PASS container.childAtIndex(0).isEqual(button2) === true
+PASS container.childAtIndex(1).isEqual(button3) === true
 PASS successfullyParsed is true
 
 TEST COMPLETE
-
+Button 1
+Button 2
+Button 3

Modified: trunk/LayoutTests/accessibility/aria-hidden-update.html (286947 => 286948)


--- trunk/LayoutTests/accessibility/aria-hidden-update.html	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/aria-hidden-update.html	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1,66 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
-<html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
- 
-    <div role="group" tabindex="0" id="parent">
+<body>
+
+<div role="group" tabindex="0" id="container">
     <div role="button" id="button1" tabindex="0">Button 1</div>
     <div role="button" id="button2" tabindex="0">Button 2</div>
     <div role="button" id="button3" tabindex="0">Button 3</div>
+</div>
 
-    </div>
+<script>
+    description("This test makes sure that when aria-hidden changes, the AX hierarchy is updated.");
 
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-    <p id="description"></p>
-    <div id="console"></div>
-     
-    <script>
-        if (window.accessibilityController) {
-            jsTestIsAsync = true;
-            description("This test makes sure that when aria-hidden changes, the AX hierarchy is updated.");
+        var container = accessibilityController.accessibleElementById("container");
+        var button1 = accessibilityController.accessibleElementById("button1");;
+        var button2 = accessibilityController.accessibleElementById("button2");;
+        var button3 = accessibilityController.accessibleElementById("button3");;
 
-            // Get the parent element.
-            document.getElementById("parent").focus();
-            var parent = accessibilityController.focusedElement;
-            
-            // Get all three children.
-            document.getElementById("button1").focus();
-            var button1 = accessibilityController.focusedElement;
-            document.getElementById("button2").focus();
-            var button2 = accessibilityController.focusedElement;
-            document.getElementById("button3").focus();
-            var button3 = accessibilityController.focusedElement;
-      
-            // Verify that the 3 children are present.
-            shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
-            shouldBeTrue("parent.childAtIndex(1).isEqual(button2)");
-            shouldBeTrue("parent.childAtIndex(2).isEqual(button3)");
+        // Verify that the 3 buttons are present as children.
+        shouldBeTrue("container.childAtIndex(0).isEqual(button1)");
+        shouldBeTrue("container.childAtIndex(1).isEqual(button2)");
+        shouldBeTrue("container.childAtIndex(2).isEqual(button3)");
 
-            // Make the 2nd button hidden. Only 1 and 3 should be present.
-            document.getElementById("button2").setAttribute("aria-hidden", "true");
-            setTimeout(function() {
-                shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
-                shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
+        // Make the 2nd button hidden. Only 1 and 3 should be present.
+        document.getElementById("button2").setAttribute("aria-hidden", "true");
+        shouldBeTrue("container.childAtIndex(0).isEqual(button1)");
+        setTimeout(async function() {
+            await expectAsyncExpression("container.childAtIndex(1).isEqual(button3)", "true");
            
-                // Make the 1st button hidden. Only 3 should be present.
-                document.getElementById("button1").setAttribute("aria-hidden", "true");
-                setTimeout(function() {
-                    shouldBeTrue("parent.childAtIndex(0).isEqual(button3)");
+            // Make the 1st button hidden. Only 3 should be present.
+            document.getElementById("button1").setAttribute("aria-hidden", "true");
+            await expectAsyncExpression("container.childAtIndex(0).isEqual(button3)", "true");
 
-                    // Make the 2nd button not hidden. 2 and 3 should be present.
-                    document.getElementById("button2").setAttribute("aria-hidden", "false");
-                    setTimeout(function() {
-                        shouldBeTrue("parent.childAtIndex(0).isEqual(button2)");
-                        shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
-                        finishJSTest();
-                    }, 0);
-                }, 0);
-            }, 0);
-        }
-    </script>
+            // Make the 2nd button not hidden. 2 and 3 should be present.
+            document.getElementById("button2").setAttribute("aria-hidden", "false");
+            await expectAsyncExpression("container.childAtIndex(0).isEqual(button2)", "true");
+            await expectAsyncExpression("container.childAtIndex(1).isEqual(button3)", "true");
 
-<script src=""
+            finishJSTest();
+        }, 0);
+    }
+</script>
 </body>
 </html>

Modified: trunk/LayoutTests/accessibility/focusable-div-expected.txt (286947 => 286948)


--- trunk/LayoutTests/accessibility/focusable-div-expected.txt	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/focusable-div-expected.txt	2021-12-13 16:20:39 UTC (rev 286948)
@@ -3,22 +3,22 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS document.activeElement == link is true
+PASS document.activeElement.id is "link"
 PASS lastChar(axLink.title) is "A"
-PASS document.activeElement == div is true
+PASS document.activeElement.id is "div"
 PASS lastChar(axDiv.title) is ' '
-PASS document.activeElement == div2 is true
+PASS document.activeElement.id is "div2"
 PASS lastChar(axDiv2.title) is ' '
-PASS document.activeElement == div3 is true
+PASS document.activeElement.id is "div3"
 PASS lastChar(accNameForDiv3) is "D"
-PASS document.activeElement == div4 is true
+PASS document.activeElement.id is "div4"
 PASS axDiv4.title.indexOf('Link') is -1
-PASS document.activeElement == div5 is true
+PASS document.activeElement.id is "div5"
 PASS axDiv5.title.indexOf('Link') is -1
 PASS axDiv5.title.indexOf('Initial text before link') >= 0 is false
-PASS document.activeElement == div6 is true
+PASS document.activeElement.id is "div6"
 PASS axDiv6.title.indexOf('List item') is -1
-PASS document.activeElement == div7 is true
+PASS document.activeElement.id is "div7"
 PASS axDiv7.title.indexOf('List item') is -1
 PASS axDiv7.title.indexOf('Initial text before list') >= 0 is false
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/accessibility/focusable-div.html (286947 => 286948)


--- trunk/LayoutTests/accessibility/focusable-div.html	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/focusable-div.html	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1,92 +1,80 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
+<head>
+<script src=""
+<script src=""
+</head>
 <body>
-<script src=""
-<script src=""
 
 <div id="content">
+    <!-- A link always gets its accessible text from contents. -->
+    <a id="link" href=""
 
-<!-- A link always gets its accessible text from contents. -->
-<a id="link" href=""
+    <!-- A generic focusable div should not get its accessible text from contents. -->
+    <div id="div" tabindex="0">B</div>
+    <div id="div2" tabindex="0"><div></div>C</div>
+    <div id="div3" tabindex="0" aria-label="D"></div>
 
-<!-- A generic focusable div should not get its accessible text from contents. -->
-<div id="div" tabindex="0">B</div>
-<div id="div2" tabindex="0"><div></div>C</div>
-<div id="div3" tabindex="0" aria-label="D"></div>
+    <!-- A generic focusable div should not get accessible text from children that are focusable or containers. -->
+    <div id="div4" tabindex="0"><a href=""
+    <div id="div5" tabindex="0">Initial text before link<a href=""
+    <div id="div6" tabindex="0"><ul><li>List item</li></ul></div>
+    <div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul></div>
+</div>
 
-<!-- A generic focusable div should not get accessible text from children that are focusable or containers. -->
-<div id="div4" tabindex="0"><a href=""
-<div id="div5" tabindex="0">Initial text before link<a href=""
-<div id="div6" tabindex="0"><ul><li>List item</li></ul></div>
-<div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul></div>
-</div>
-<div id="console"></div>
 <script>
-description("This test makes sure that a generic focusable div can get accessibility focus. It should not get accessible text from its children automatically though.");
+    description("This test makes sure that a generic focusable div can get accessibility focus. It should not get accessible text from its children automatically though.");
 
-if (window.testRunner && window.accessibilityController) {
-    window.testRunner.dumpAsText();
-
     function lastChar(str) {
         return str.substr(str.length - 1);
     }
 
-    var link = document.getElementById('link');
-    link.focus();
-    shouldBe("document.activeElement == link", "true");
-    window.axLink = accessibilityController.focusedElement;
-    shouldBe("lastChar(axLink.title)", "\"A\"");
+    async function waitForFocus(id) {
+        document.getElementById(id).focus();
+        shouldBe("document.activeElement.id", `"${id}"`);
+        let axFocusedElement;
+        await waitFor(() => {
+            axFocusedElement = accessibilityController.focusedElement;
+            return axFocusedElement && axFocusedElement.domIdentifier === id;
+        });
+        return axFocusedElement;
+    }
 
-    var div = document.getElementById('div');
-    div.focus();
-    shouldBe("document.activeElement == div", "true");
-    window.axDiv = accessibilityController.focusedElement;
-    shouldBe("lastChar(axDiv.title)", "' '");
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-    var div2 = document.getElementById('div2');
-    div2.focus();
-    shouldBe("document.activeElement == div2", "true");
-    window.axDiv2 = accessibilityController.focusedElement;
-    shouldBe("lastChar(axDiv2.title)", "' '");
+        setTimeout(async function() {
+            window.axLink = await waitForFocus("link");
+            shouldBe("lastChar(axLink.title)", "\"A\"");
 
-    var div3 = document.getElementById('div3');
-    div3.focus();
-    shouldBe("document.activeElement == div3", "true");
-    window.axDiv3 = accessibilityController.focusedElement;
-    var accNameForDiv3 = platformValueForW3CName(axDiv3);
-    shouldBe("lastChar(accNameForDiv3)", "\"D\"");
+            window.axDiv = await waitForFocus("div");
+            shouldBe("lastChar(axDiv.title)", "' '");
 
-    var div4 = document.getElementById('div4');
-    div4.focus();
-    shouldBe("document.activeElement == div4", "true");
-    window.axDiv4 = accessibilityController.focusedElement;
-    shouldBe("axDiv4.title.indexOf('Link')", "-1");
+            window.axDiv2 = await waitForFocus("div2");
+            shouldBe("lastChar(axDiv2.title)", "' '");
 
-    var div5 = document.getElementById('div5');
-    div5.focus();
-    shouldBe("document.activeElement == div5", "true");
-    window.axDiv5 = accessibilityController.focusedElement;
-    shouldBe("axDiv5.title.indexOf('Link')", "-1");
-    shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "false");
+            window.accNameForDiv3 = platformValueForW3CName(await waitForFocus("div3"));
+            shouldBe("lastChar(accNameForDiv3)", "\"D\"");
 
-    var div6 = document.getElementById('div6');
-    div6.focus();
-    shouldBe("document.activeElement == div6", "true");
-    window.axDiv6 = accessibilityController.focusedElement;
-    shouldBe("axDiv6.title.indexOf('List item')", "-1");
+            window.axDiv4 = await waitForFocus("div4");
+            shouldBe("axDiv4.title.indexOf('Link')", "-1");
 
-    var div7 = document.getElementById('div7');
-    div7.focus();
-    shouldBe("document.activeElement == div7", "true");
-    window.axDiv7 = accessibilityController.focusedElement;
-    shouldBe("axDiv7.title.indexOf('List item')", "-1");
-    shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "false");
+            window.axDiv5 = await waitForFocus("div5");
+            shouldBe("axDiv5.title.indexOf('Link')", "-1");
+            shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "false");
 
-    document.getElementById("content").style.visibility = "hidden";
-}
+            window.axDiv6 = await waitForFocus("div6");
+            shouldBe("axDiv6.title.indexOf('List item')", "-1");
 
+            window.axDiv7 = await waitForFocus("div7");
+            shouldBe("axDiv7.title.indexOf('List item')", "-1");
+            shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "false");
+
+            document.getElementById("content").style.visibility = "hidden";
+
+            finishJSTest();
+        }, 0);
+    }
 </script>
-
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/accessibility/mac/css-speech-speak-expected.txt (286947 => 286948)


--- trunk/LayoutTests/accessibility/mac/css-speech-speak-expected.txt	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/mac/css-speech-speak-expected.txt	2021-12-13 16:20:39 UTC (rev 286948)
@@ -12,15 +12,24 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'spell-out'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, literal-punctuation'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, no-punctuation'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits, literal-punctuation'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'spell-out, literal-punctuation'
-PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits'
+Testing #initial
+PASS element.childAtIndex(0).speakAs is "normal"
+Testing #speech-normal
+PASS element.childAtIndex(0).speakAs is "normal"
+Testing #speech-spellout
+PASS element.childAtIndex(0).speakAs is "spell-out"
+Testing #speech-digits
+PASS element.childAtIndex(0).speakAs is "normal, digits"
+Testing #speech-literalpunc
+PASS element.childAtIndex(0).speakAs is "normal, literal-punctuation"
+Testing #speech-nopunc
+PASS element.childAtIndex(0).speakAs is "normal, no-punctuation"
+Testing #speech-digits-and-literal
+PASS element.childAtIndex(0).speakAs is "normal, digits, literal-punctuation"
+Testing #speech-spell-and-literal
+PASS element.childAtIndex(0).speakAs is "spell-out, literal-punctuation"
+Testing #testlink
+PASS element.childAtIndex(0).speakAs is "normal, digits"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/mac/css-speech-speak.html (286947 => 286948)


--- trunk/LayoutTests/accessibility/mac/css-speech-speak.html	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/mac/css-speech-speak.html	2021-12-13 16:20:39 UTC (rev 286948)
@@ -39,34 +39,23 @@
 
     description("This tests that using the CSS3-speech property 'speak-as' works as from a WebCore level (not a platform level, that is up to the platforms)");
 
+    var element;
+    function expectValueForId(id, expectedValue) {
+        debug(`Testing #${id}`)
+        element = accessibilityController.accessibleElementById(id);
+        shouldBe("element.childAtIndex(0).speakAs", `"${expectedValue}"`);
+    }
+
     if (window.accessibilityController) {
-
-          document.getElementById("initial").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal'");
-
-          document.getElementById("speech-normal").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal'");
-
-          document.getElementById("speech-spellout").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'spell-out'");
-
-          document.getElementById("speech-digits").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits'");
-
-          document.getElementById("speech-literalpunc").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, literal-punctuation'");
-
-          document.getElementById("speech-nopunc").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, no-punctuation'");
-
-          document.getElementById("speech-digits-and-literal").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits, literal-punctuation'");
-
-          document.getElementById("speech-spell-and-literal").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'spell-out, literal-punctuation'");
-
-          document.getElementById("testlink").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits'");
+        expectValueForId("initial", "normal");
+        expectValueForId("speech-normal", "normal");
+        expectValueForId("speech-spellout", "spell-out");
+        expectValueForId("speech-digits", "normal, digits");
+        expectValueForId("speech-literalpunc", "normal, literal-punctuation");
+        expectValueForId("speech-nopunc", "normal, no-punctuation");
+        expectValueForId("speech-digits-and-literal", "normal, digits, literal-punctuation");
+        expectValueForId("speech-spell-and-literal", "spell-out, literal-punctuation");
+        expectValueForId("testlink", "normal, digits");
     }
 
 </script>

Modified: trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt (286947 => 286948)


--- trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1,13 +1,21 @@
-
 This tests that we are exposing correct invalid status for different types.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS: AXInvalid is true.
-PASS: AXInvalid is false.
-PASS: AXInvalid is true.
-PASS: AXInvalid is false.
-PASS: AXInvalid is true.
-PASS: AXInvalid is false.
+Testing #number-input-valid
+PASS input.stringAttributeValue('AXInvalid') is 'false'
+Testing #url-input-invalid
+PASS input.stringAttributeValue('AXInvalid') is 'true'
+Testing #url-input-valid
+PASS input.stringAttributeValue('AXInvalid') is 'false'
+Testing #email-input-invalid
+PASS input.stringAttributeValue('AXInvalid') is 'true'
+Testing #email-input-valid
+PASS input.stringAttributeValue('AXInvalid') is 'false'
+Testing #number-input-invalid
+PASS input.stringAttributeValue('AXInvalid') is 'true'
+PASS successfullyParsed is true
 
+TEST COMPLETE
+

Modified: trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html (286947 => 286948)


--- trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1,56 +1,54 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
-<div id="examples">
-    <input class="ex" data-expected="true" type="number" value="abc">
-    <input class="ex" data-expected="false" type="number" value="10">
-    
-    <input class="ex" data-expected="true" type="url" value="abc">
-    <input class="ex" data-expected="false" type="url" value="http://abc.com">
-    
-    <input class="ex" data-expected="true" type="email" value="abc">
-    <input class="ex" data-expected="false" type="email" value="a...@abc.com">
-</div>
+<input id="number-input-invalid" type="number" value="abc">
+<input id="number-input-valid" type="number" value="10">
 
-<p id="description"></p>
-<div id="console"></div>
+<input id="url-input-invalid" type="url" value="abc">
+<input id="url-input-valid" type="url" value="http://abc.com">
 
+<input id="email-input-invalid" type="email" value="abc">
+<input id="email-input-valid" type="email" value="a...@abc.com">
+
 <script>
-
     description("This tests that we are exposing correct invalid status for different types.");
 
-    function $(id){
-        return document.getElementById(id);
+    var input;
+    function expectAXInvalid(id, expectedValue) {
+        debug(`Testing #${id}`);
+        input = accessibilityController.accessibleElementById(id);
+        shouldBe("input.stringAttributeValue('AXInvalid')", `'${expectedValue}'`);
     }
 
-    var result = $('console');
-    function verify(value, expectation, element) {
-      if (value === expectation)
-        result.innerText += "PASS: AXInvalid is " + value + ".\n";
-      else
-        result.innerText += "FAIL: AXInvalid is " + value + ". Expected: " + expectation + ". " + (element ? element.outerHTML : "") + "\n";
-    }
-
     if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-        var examples = document.querySelectorAll(".ex");
-        for (var i = 0, c = examples.length; i < c; i++) {
-            var el = examples[i];
-            el.focus();
-            if (i == 0)
-                eventSender.keyDown('a');
-            var expectation = el.getAttribute("data-expected");
-            var value = accessibilityController.focusedElement.stringAttributeValue('AXInvalid');
-            verify(value, expectation, el);
-        }
+        expectAXInvalid("number-input-valid", false);
+        expectAXInvalid("url-input-invalid", true);
+        expectAXInvalid("url-input-valid", false);
+        expectAXInvalid("email-input-invalid", true);
+        expectAXInvalid("email-input-valid", false);
+
+        setTimeout(async function() {
+            // For <input type="number" value="abc"> inputs, we must explicitly send a non-number keystroke for it to be
+            // considered invalid at the HTMLInputElement level despite the `value` attribute clearly not being a valid number.
+            document.getElementById("number-input-invalid").focus();
+            eventSender.keyDown("a");
+            await waitFor(() => {
+                input = accessibilityController.accessibleElementById("number-input-invalid");
+                return input && input.stringAttributeValue("AXInvalid") === "true";
+            });
+            expectAXInvalid("number-input-invalid", true);
+
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/platform/glib/TestExpectations (286947 => 286948)


--- trunk/LayoutTests/platform/glib/TestExpectations	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2021-12-13 16:20:39 UTC (rev 286948)
@@ -307,6 +307,9 @@
 # AccessibilityUIElement::isInCell().
 accessibility/ancestor-computation.html [ Skip ]
 
+# Need to implement AccessibilityUIElement::domIdentifier() for this test to pass after webkit.org/b/234198.
+accessibility/focusable-div.html [ Skip ]
+
 webkit.org/b/212805 accessibility/svg-text.html [ Failure ]
 
 # Added in r263823. Both tests are timing out.

Modified: trunk/LayoutTests/platform/win/TestExpectations (286947 => 286948)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-12-13 15:18:11 UTC (rev 286947)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-12-13 16:20:39 UTC (rev 286948)
@@ -1570,7 +1570,11 @@
 [ Release ] accessibility/element-haspopup.html [ Failure ]
 [ Debug ] accessibility/element-haspopup.html [ Skip ] # Crash (Debug Assertion)
 [ Debug ] accessibility/first-letter-text-transform-causes-crash.html [ Skip ] # Crash (Debug Assertion)
-webkit.org/b/140867 [ Debug ] accessibility/focusable-div.html [ Skip ]
+
+# In addition to the issues raised in the associated bug, also need to implement
+# AccessibilityUIElement::domIdentifier() for this test to pass due to webkit.org/b/234198.
+webkit.org/b/140867 accessibility/focusable-div.html [ Skip ]
+
 [ Release ] accessibility/frame-disconnect-textmarker-cache-crash.html [ Failure ]
 [ Debug ] accessibility/frame-disconnect-textmarker-cache-crash.html [ Skip ] # Crash (Debug Assertion)
 [ Debug ] accessibility/hang-in-isignored.html [ Skip ] # Crash (Debug Assertion)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to