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

Changeset 286948 in webkit


Ignore:
Timestamp:
Dec 13, 2021, 8:20:39 AM (5 years ago)
Author:
Tyler Wilcock
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.

Location:
trunk/LayoutTests
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r286944 r286948  
     12021-12-13  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        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
     4        https://bugs.webkit.org/show_bug.cgi?id=234198
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Make the following tests async or otherwise isolated-tree friendly
     9        (i.e. by using accessibleElementById instead of document.getElementById().focus() +
     10        accessibilityController.focusedElement to get a JS reference to an AX object).
     11
     12        * accessibility/aria-hidden-update-expected.txt:
     13        * accessibility/aria-hidden-update.html:
     14        * accessibility/focusable-div-expected.txt:
     15        * accessibility/focusable-div.html:
     16        * accessibility/mac/invalid-status-for-input-types-expected.txt:
     17        * accessibility/mac/invalid-status-for-input-types.html:
     18        Make these tests async. These tests must be async to pass in isolated
     19        tree mode because they use JS to dynamically change the page.
     20        * accessibility/mac/css-speech-speak-expected.txt:
     21        * accessibility/mac/css-speech-speak.html:
     22        Use accessibleElementById instead of document.getElementById().focus() +
     23        accessibilityController.focusedElement to get references to JS AX objects.
     24
     25        * platform/glib/TestExpectations:
     26        * platform/win/TestExpectations:
     27        Skip accessibility/focusable-div.html due to lack of
     28        AccessibilityUIElement::domIdentifier implementation.
     29
    1302021-12-13  Youenn Fablet  <youenn@apple.com>
    231
  • trunk/LayoutTests/accessibility/aria-hidden-update-expected.txt

    r68108 r286948  
    1 Button 1
    2 Button 2
    3 Button 3
    41This test makes sure that when aria-hidden changes, the AX hierarchy is updated.
    52
     
    74
    85
    9 PASS parent.childAtIndex(0).isEqual(button1) is true
    10 PASS parent.childAtIndex(1).isEqual(button2) is true
    11 PASS parent.childAtIndex(2).isEqual(button3) is true
    12 PASS parent.childAtIndex(0).isEqual(button1) is true
    13 PASS parent.childAtIndex(1).isEqual(button3) is true
    14 PASS parent.childAtIndex(0).isEqual(button3) is true
    15 PASS parent.childAtIndex(0).isEqual(button2) is true
    16 PASS parent.childAtIndex(1).isEqual(button3) is true
     6PASS container.childAtIndex(0).isEqual(button1) is true
     7PASS container.childAtIndex(1).isEqual(button2) is true
     8PASS container.childAtIndex(2).isEqual(button3) is true
     9PASS container.childAtIndex(0).isEqual(button1) is true
     10PASS container.childAtIndex(1).isEqual(button3) === true
     11PASS container.childAtIndex(0).isEqual(button3) === true
     12PASS container.childAtIndex(0).isEqual(button2) === true
     13PASS container.childAtIndex(1).isEqual(button3) === true
    1714PASS successfullyParsed is true
    1815
    1916TEST COMPLETE
    20 
     17Button 1
     18Button 2
     19Button 3
  • trunk/LayoutTests/accessibility/aria-hidden-update.html

    r241289 r286948  
    1 <html>
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    22<html>
    33<head>
    4 <script src="../resources/js-test-pre.js"></script>
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
    56</head>
    6 <body id="body">
    7  
    8     <div role="group" tabindex="0" id="parent">
     7<body>
     8
     9<div role="group" tabindex="0" id="container">
    910    <div role="button" id="button1" tabindex="0">Button 1</div>
    1011    <div role="button" id="button2" tabindex="0">Button 2</div>
    1112    <div role="button" id="button3" tabindex="0">Button 3</div>
     13</div>
    1214
    13     </div>
     15<script>
     16    description("This test makes sure that when aria-hidden changes, the AX hierarchy is updated.");
    1417
     18    if (window.accessibilityController) {
     19        window.jsTestIsAsync = true;
    1520
    16     <p id="description"></p>
    17     <div id="console"></div>
    18      
    19     <script>
    20         if (window.accessibilityController) {
    21             jsTestIsAsync = true;
    22             description("This test makes sure that when aria-hidden changes, the AX hierarchy is updated.");
     21        var container = accessibilityController.accessibleElementById("container");
     22        var button1 = accessibilityController.accessibleElementById("button1");;
     23        var button2 = accessibilityController.accessibleElementById("button2");;
     24        var button3 = accessibilityController.accessibleElementById("button3");;
    2325
    24             // Get the parent element.
    25             document.getElementById("parent").focus();
    26             var parent = accessibilityController.focusedElement;
    27            
    28             // Get all three children.
    29             document.getElementById("button1").focus();
    30             var button1 = accessibilityController.focusedElement;
    31             document.getElementById("button2").focus();
    32             var button2 = accessibilityController.focusedElement;
    33             document.getElementById("button3").focus();
    34             var button3 = accessibilityController.focusedElement;
    35      
    36             // Verify that the 3 children are present.
    37             shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
    38             shouldBeTrue("parent.childAtIndex(1).isEqual(button2)");
    39             shouldBeTrue("parent.childAtIndex(2).isEqual(button3)");
     26        // Verify that the 3 buttons are present as children.
     27        shouldBeTrue("container.childAtIndex(0).isEqual(button1)");
     28        shouldBeTrue("container.childAtIndex(1).isEqual(button2)");
     29        shouldBeTrue("container.childAtIndex(2).isEqual(button3)");
    4030
    41             // Make the 2nd button hidden. Only 1 and 3 should be present.
    42             document.getElementById("button2").setAttribute("aria-hidden", "true");
    43             setTimeout(function() {
    44                 shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
    45                 shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
     31        // Make the 2nd button hidden. Only 1 and 3 should be present.
     32        document.getElementById("button2").setAttribute("aria-hidden", "true");
     33        shouldBeTrue("container.childAtIndex(0).isEqual(button1)");
     34        setTimeout(async function() {
     35            await expectAsyncExpression("container.childAtIndex(1).isEqual(button3)", "true");
    4636           
    47                 // Make the 1st button hidden. Only 3 should be present.
    48                 document.getElementById("button1").setAttribute("aria-hidden", "true");
    49                 setTimeout(function() {
    50                     shouldBeTrue("parent.childAtIndex(0).isEqual(button3)");
     37            // Make the 1st button hidden. Only 3 should be present.
     38            document.getElementById("button1").setAttribute("aria-hidden", "true");
     39            await expectAsyncExpression("container.childAtIndex(0).isEqual(button3)", "true");
    5140
    52                     // Make the 2nd button not hidden. 2 and 3 should be present.
    53                     document.getElementById("button2").setAttribute("aria-hidden", "false");
    54                     setTimeout(function() {
    55                         shouldBeTrue("parent.childAtIndex(0).isEqual(button2)");
    56                         shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
    57                         finishJSTest();
    58                     }, 0);
    59                 }, 0);
    60             }, 0);
    61         }
    62     </script>
     41            // Make the 2nd button not hidden. 2 and 3 should be present.
     42            document.getElementById("button2").setAttribute("aria-hidden", "false");
     43            await expectAsyncExpression("container.childAtIndex(0).isEqual(button2)", "true");
     44            await expectAsyncExpression("container.childAtIndex(1).isEqual(button3)", "true");
    6345
    64 <script src="../resources/js-test-post.js"></script>
     46            finishJSTest();
     47        }, 0);
     48    }
     49</script>
    6550</body>
    6651</html>
  • trunk/LayoutTests/accessibility/focusable-div-expected.txt

    r201216 r286948  
    44
    55
    6 PASS document.activeElement == link is true
     6PASS document.activeElement.id is "link"
    77PASS lastChar(axLink.title) is "A"
    8 PASS document.activeElement == div is true
     8PASS document.activeElement.id is "div"
    99PASS lastChar(axDiv.title) is ' '
    10 PASS document.activeElement == div2 is true
     10PASS document.activeElement.id is "div2"
    1111PASS lastChar(axDiv2.title) is ' '
    12 PASS document.activeElement == div3 is true
     12PASS document.activeElement.id is "div3"
    1313PASS lastChar(accNameForDiv3) is "D"
    14 PASS document.activeElement == div4 is true
     14PASS document.activeElement.id is "div4"
    1515PASS axDiv4.title.indexOf('Link') is -1
    16 PASS document.activeElement == div5 is true
     16PASS document.activeElement.id is "div5"
    1717PASS axDiv5.title.indexOf('Link') is -1
    1818PASS axDiv5.title.indexOf('Initial text before link') >= 0 is false
    19 PASS document.activeElement == div6 is true
     19PASS document.activeElement.id is "div6"
    2020PASS axDiv6.title.indexOf('List item') is -1
    21 PASS document.activeElement == div7 is true
     21PASS document.activeElement.id is "div7"
    2222PASS axDiv7.title.indexOf('List item') is -1
    2323PASS axDiv7.title.indexOf('Initial text before list') >= 0 is false
  • trunk/LayoutTests/accessibility/focusable-div.html

    r201216 r286948  
    1 <!DOCTYPE HTML>
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    22<html>
     3<head>
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
     6</head>
    37<body>
    4 <script src="../resources/js-test-pre.js"></script>
    5 <script src="../resources/accessibility-helper.js"></script>
    68
    79<div id="content">
     10    <!-- A link always gets its accessible text from contents. -->
     11    <a id="link" href="#">A</a>
    812
    9 <!-- A link always gets its accessible text from contents. -->
    10 <a id="link" href="#">A</a>
     13    <!-- A generic focusable div should not get its accessible text from contents. -->
     14    <div id="div" tabindex="0">B</div>
     15    <div id="div2" tabindex="0"><div></div>C</div>
     16    <div id="div3" tabindex="0" aria-label="D"></div>
    1117
    12 <!-- A generic focusable div should not get its accessible text from contents. -->
    13 <div id="div" tabindex="0">B</div>
    14 <div id="div2" tabindex="0"><div></div>C</div>
    15 <div id="div3" tabindex="0" aria-label="D"></div>
     18    <!-- A generic focusable div should not get accessible text from children that are focusable or containers. -->
     19    <div id="div4" tabindex="0"><a href="#">Link</a></div>
     20    <div id="div5" tabindex="0">Initial text before link<a href="#">Link</a></div>
     21    <div id="div6" tabindex="0"><ul><li>List item</li></ul></div>
     22    <div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul></div>
     23</div>
    1624
    17 <!-- A generic focusable div should not get accessible text from children that are focusable or containers. -->
    18 <div id="div4" tabindex="0"><a href="#">Link</a></div>
    19 <div id="div5" tabindex="0">Initial text before link<a href="#">Link</a></div>
    20 <div id="div6" tabindex="0"><ul><li>List item</li></ul></div>
    21 <div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul></div>
    22 </div>
    23 <div id="console"></div>
    2425<script>
    25 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.");
    26 
    27 if (window.testRunner && window.accessibilityController) {
    28     window.testRunner.dumpAsText();
     26    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.");
    2927
    3028    function lastChar(str) {
     
    3230    }
    3331
    34     var link = document.getElementById('link');
    35     link.focus();
    36     shouldBe("document.activeElement == link", "true");
    37     window.axLink = accessibilityController.focusedElement;
    38     shouldBe("lastChar(axLink.title)", "\"A\"");
     32    async function waitForFocus(id) {
     33        document.getElementById(id).focus();
     34        shouldBe("document.activeElement.id", `"${id}"`);
     35        let axFocusedElement;
     36        await waitFor(() => {
     37            axFocusedElement = accessibilityController.focusedElement;
     38            return axFocusedElement && axFocusedElement.domIdentifier === id;
     39        });
     40        return axFocusedElement;
     41    }
    3942
    40     var div = document.getElementById('div');
    41     div.focus();
    42     shouldBe("document.activeElement == div", "true");
    43     window.axDiv = accessibilityController.focusedElement;
    44     shouldBe("lastChar(axDiv.title)", "' '");
     43    if (window.accessibilityController) {
     44        window.jsTestIsAsync = true;
    4545
    46     var div2 = document.getElementById('div2');
    47     div2.focus();
    48     shouldBe("document.activeElement == div2", "true");
    49     window.axDiv2 = accessibilityController.focusedElement;
    50     shouldBe("lastChar(axDiv2.title)", "' '");
     46        setTimeout(async function() {
     47            window.axLink = await waitForFocus("link");
     48            shouldBe("lastChar(axLink.title)", "\"A\"");
    5149
    52     var div3 = document.getElementById('div3');
    53     div3.focus();
    54     shouldBe("document.activeElement == div3", "true");
    55     window.axDiv3 = accessibilityController.focusedElement;
    56     var accNameForDiv3 = platformValueForW3CName(axDiv3);
    57     shouldBe("lastChar(accNameForDiv3)", "\"D\"");
     50            window.axDiv = await waitForFocus("div");
     51            shouldBe("lastChar(axDiv.title)", "' '");
    5852
    59     var div4 = document.getElementById('div4');
    60     div4.focus();
    61     shouldBe("document.activeElement == div4", "true");
    62     window.axDiv4 = accessibilityController.focusedElement;
    63     shouldBe("axDiv4.title.indexOf('Link')", "-1");
     53            window.axDiv2 = await waitForFocus("div2");
     54            shouldBe("lastChar(axDiv2.title)", "' '");
    6455
    65     var div5 = document.getElementById('div5');
    66     div5.focus();
    67     shouldBe("document.activeElement == div5", "true");
    68     window.axDiv5 = accessibilityController.focusedElement;
    69     shouldBe("axDiv5.title.indexOf('Link')", "-1");
    70     shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "false");
     56            window.accNameForDiv3 = platformValueForW3CName(await waitForFocus("div3"));
     57            shouldBe("lastChar(accNameForDiv3)", "\"D\"");
    7158
    72     var div6 = document.getElementById('div6');
    73     div6.focus();
    74     shouldBe("document.activeElement == div6", "true");
    75     window.axDiv6 = accessibilityController.focusedElement;
    76     shouldBe("axDiv6.title.indexOf('List item')", "-1");
     59            window.axDiv4 = await waitForFocus("div4");
     60            shouldBe("axDiv4.title.indexOf('Link')", "-1");
    7761
    78     var div7 = document.getElementById('div7');
    79     div7.focus();
    80     shouldBe("document.activeElement == div7", "true");
    81     window.axDiv7 = accessibilityController.focusedElement;
    82     shouldBe("axDiv7.title.indexOf('List item')", "-1");
    83     shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "false");
     62            window.axDiv5 = await waitForFocus("div5");
     63            shouldBe("axDiv5.title.indexOf('Link')", "-1");
     64            shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "false");
    8465
    85     document.getElementById("content").style.visibility = "hidden";
    86 }
     66            window.axDiv6 = await waitForFocus("div6");
     67            shouldBe("axDiv6.title.indexOf('List item')", "-1");
    8768
     69            window.axDiv7 = await waitForFocus("div7");
     70            shouldBe("axDiv7.title.indexOf('List item')", "-1");
     71            shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "false");
     72
     73            document.getElementById("content").style.visibility = "hidden";
     74
     75            finishJSTest();
     76        }, 0);
     77    }
    8878</script>
    89 
    90 <script src="../resources/js-test-post.js"></script>
    9179</body>
    9280</html>
  • trunk/LayoutTests/accessibility/mac/css-speech-speak-expected.txt

    r226432 r286948  
    1313
    1414
    15 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal'
    16 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal'
    17 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'spell-out'
    18 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits'
    19 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, literal-punctuation'
    20 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, no-punctuation'
    21 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits, literal-punctuation'
    22 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'spell-out, literal-punctuation'
    23 PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits'
     15Testing #initial
     16PASS element.childAtIndex(0).speakAs is "normal"
     17Testing #speech-normal
     18PASS element.childAtIndex(0).speakAs is "normal"
     19Testing #speech-spellout
     20PASS element.childAtIndex(0).speakAs is "spell-out"
     21Testing #speech-digits
     22PASS element.childAtIndex(0).speakAs is "normal, digits"
     23Testing #speech-literalpunc
     24PASS element.childAtIndex(0).speakAs is "normal, literal-punctuation"
     25Testing #speech-nopunc
     26PASS element.childAtIndex(0).speakAs is "normal, no-punctuation"
     27Testing #speech-digits-and-literal
     28PASS element.childAtIndex(0).speakAs is "normal, digits, literal-punctuation"
     29Testing #speech-spell-and-literal
     30PASS element.childAtIndex(0).speakAs is "spell-out, literal-punctuation"
     31Testing #testlink
     32PASS element.childAtIndex(0).speakAs is "normal, digits"
    2433PASS successfullyParsed is true
    2534
  • trunk/LayoutTests/accessibility/mac/css-speech-speak.html

    r226432 r286948  
    4040    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)");
    4141
     42    var element;
     43    function expectValueForId(id, expectedValue) {
     44        debug(`Testing #${id}`)
     45        element = accessibilityController.accessibleElementById(id);
     46        shouldBe("element.childAtIndex(0).speakAs", `"${expectedValue}"`);
     47    }
     48
    4249    if (window.accessibilityController) {
    43 
    44           document.getElementById("initial").focus();
    45           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal'");
    46 
    47           document.getElementById("speech-normal").focus();
    48           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal'");
    49 
    50           document.getElementById("speech-spellout").focus();
    51           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'spell-out'");
    52 
    53           document.getElementById("speech-digits").focus();
    54           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits'");
    55 
    56           document.getElementById("speech-literalpunc").focus();
    57           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, literal-punctuation'");
    58 
    59           document.getElementById("speech-nopunc").focus();
    60           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, no-punctuation'");
    61 
    62           document.getElementById("speech-digits-and-literal").focus();
    63           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits, literal-punctuation'");
    64 
    65           document.getElementById("speech-spell-and-literal").focus();
    66           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'spell-out, literal-punctuation'");
    67 
    68           document.getElementById("testlink").focus();
    69           shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits'");
     50        expectValueForId("initial", "normal");
     51        expectValueForId("speech-normal", "normal");
     52        expectValueForId("speech-spellout", "spell-out");
     53        expectValueForId("speech-digits", "normal, digits");
     54        expectValueForId("speech-literalpunc", "normal, literal-punctuation");
     55        expectValueForId("speech-nopunc", "normal, no-punctuation");
     56        expectValueForId("speech-digits-and-literal", "normal, digits, literal-punctuation");
     57        expectValueForId("speech-spell-and-literal", "spell-out, literal-punctuation");
     58        expectValueForId("testlink", "normal, digits");
    7059    }
    7160
  • trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt

    r267644 r286948  
    1 
    21This tests that we are exposing correct invalid status for different types.
    32
     
    54
    65
    7 PASS: AXInvalid is true.
    8 PASS: AXInvalid is false.
    9 PASS: AXInvalid is true.
    10 PASS: AXInvalid is false.
    11 PASS: AXInvalid is true.
    12 PASS: AXInvalid is false.
     6Testing #number-input-valid
     7PASS input.stringAttributeValue('AXInvalid') is 'false'
     8Testing #url-input-invalid
     9PASS input.stringAttributeValue('AXInvalid') is 'true'
     10Testing #url-input-valid
     11PASS input.stringAttributeValue('AXInvalid') is 'false'
     12Testing #email-input-invalid
     13PASS input.stringAttributeValue('AXInvalid') is 'true'
     14Testing #email-input-valid
     15PASS input.stringAttributeValue('AXInvalid') is 'false'
     16Testing #number-input-invalid
     17PASS input.stringAttributeValue('AXInvalid') is 'true'
     18PASS successfullyParsed is true
    1319
     20TEST COMPLETE
     21
  • trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html

    r207035 r286948  
    22<html>
    33<head>
    4 <script src="../../resources/js-test-pre.js"></script>
     4<script src="../../resources/js-test.js"></script>
     5<script src="../../resources/accessibility-helper.js"></script>
    56</head>
    6 <body id="body">
     7<body>
    78
    8 <div id="examples">
    9     <input class="ex" data-expected="true" type="number" value="abc">
    10     <input class="ex" data-expected="false" type="number" value="10">
    11    
    12     <input class="ex" data-expected="true" type="url" value="abc">
    13     <input class="ex" data-expected="false" type="url" value="http://abc.com">
    14    
    15     <input class="ex" data-expected="true" type="email" value="abc">
    16     <input class="ex" data-expected="false" type="email" value="abc@abc.com">
    17 </div>
     9<input id="number-input-invalid" type="number" value="abc">
     10<input id="number-input-valid" type="number" value="10">
    1811
    19 <p id="description"></p>
    20 <div id="console"></div>
     12<input id="url-input-invalid" type="url" value="abc">
     13<input id="url-input-valid" type="url" value="http://abc.com">
     14
     15<input id="email-input-invalid" type="email" value="abc">
     16<input id="email-input-valid" type="email" value="abc@abc.com">
    2117
    2218<script>
    23 
    2419    description("This tests that we are exposing correct invalid status for different types.");
    2520
    26     function $(id){
    27         return document.getElementById(id);
    28     }
    29 
    30     var result = $('console');
    31     function verify(value, expectation, element) {
    32       if (value === expectation)
    33         result.innerText += "PASS: AXInvalid is " + value + ".\n";
    34       else
    35         result.innerText += "FAIL: AXInvalid is " + value + ". Expected: " + expectation + ". " + (element ? element.outerHTML : "") + "\n";
     21    var input;
     22    function expectAXInvalid(id, expectedValue) {
     23        debug(`Testing #${id}`);
     24        input = accessibilityController.accessibleElementById(id);
     25        shouldBe("input.stringAttributeValue('AXInvalid')", `'${expectedValue}'`);
    3626    }
    3727
    3828    if (window.accessibilityController) {
     29        window.jsTestIsAsync = true;
    3930
    40         var examples = document.querySelectorAll(".ex");
    41         for (var i = 0, c = examples.length; i < c; i++) {
    42             var el = examples[i];
    43             el.focus();
    44             if (i == 0)
    45                 eventSender.keyDown('a');
    46             var expectation = el.getAttribute("data-expected");
    47             var value = accessibilityController.focusedElement.stringAttributeValue('AXInvalid');
    48             verify(value, expectation, el);
    49         }
     31        expectAXInvalid("number-input-valid", false);
     32        expectAXInvalid("url-input-invalid", true);
     33        expectAXInvalid("url-input-valid", false);
     34        expectAXInvalid("email-input-invalid", true);
     35        expectAXInvalid("email-input-valid", false);
     36
     37        setTimeout(async function() {
     38            // For <input type="number" value="abc"> inputs, we must explicitly send a non-number keystroke for it to be
     39            // considered invalid at the HTMLInputElement level despite the `value` attribute clearly not being a valid number.
     40            document.getElementById("number-input-invalid").focus();
     41            eventSender.keyDown("a");
     42            await waitFor(() => {
     43                input = accessibilityController.accessibleElementById("number-input-invalid");
     44                return input && input.stringAttributeValue("AXInvalid") === "true";
     45            });
     46            expectAXInvalid("number-input-invalid", true);
     47
     48            finishJSTest();
     49        }, 0);
    5050    }
    51 
    5251</script>
    53 
    54 <script src="../resources/js-test-post.js"></script>
    5552</body>
    5653</html>
     54
  • trunk/LayoutTests/platform/glib/TestExpectations

    r286926 r286948  
    307307# AccessibilityUIElement::isInCell().
    308308accessibility/ancestor-computation.html [ Skip ]
     309
     310# Need to implement AccessibilityUIElement::domIdentifier() for this test to pass after webkit.org/b/234198.
     311accessibility/focusable-div.html [ Skip ]
    309312
    310313webkit.org/b/212805 accessibility/svg-text.html [ Failure ]
  • trunk/LayoutTests/platform/win/TestExpectations

    r286923 r286948  
    15711571[ Debug ] accessibility/element-haspopup.html [ Skip ] # Crash (Debug Assertion)
    15721572[ Debug ] accessibility/first-letter-text-transform-causes-crash.html [ Skip ] # Crash (Debug Assertion)
    1573 webkit.org/b/140867 [ Debug ] accessibility/focusable-div.html [ Skip ]
     1573
     1574# In addition to the issues raised in the associated bug, also need to implement
     1575# AccessibilityUIElement::domIdentifier() for this test to pass due to webkit.org/b/234198.
     1576webkit.org/b/140867 accessibility/focusable-div.html [ Skip ]
     1577
    15741578[ Release ] accessibility/frame-disconnect-textmarker-cache-crash.html [ Failure ]
    15751579[ Debug ] accessibility/frame-disconnect-textmarker-cache-crash.html [ Skip ] # Crash (Debug Assertion)
Note: See TracChangeset for help on using the changeset viewer.