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

Changeset 285778 in webkit


Ignore:
Timestamp:
Nov 13, 2021, 1:57:32 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

AX: Make 7 more layout tests async so that they pass in --release --accessibility-isolated-tree mode
https://bugs.webkit.org/show_bug.cgi?id=233085

Patch by Tyler Wilcock <Tyler Wilcock> on 2021-11-13
Reviewed by Chris Fleizach.

This patch makes 7 more tests async so that they pass in --release
--accessibility-isolated-tree mode. This patch also adds some helper
functions to accessibility-helper.js.

  • accessibility/ancestor-computation.html:

Move waitForElement to accessibility-helpers.js and rename to
waitForElementById.

  • accessibility/color-well-expected.txt:
  • accessibility/color-well.html:
  • accessibility/mac/scrollbars.html:
  • accessibility/placeholder-expected.txt:
  • accessibility/placeholder.html:
  • accessibility/progressbar-expected.txt:
  • accessibility/progressbar.html:
  • accessibility/range-alter-by-percent-expected.txt:
  • accessibility/range-alter-by-percent.html:
  • accessibility/range-alter-by-step-expected.txt:
  • accessibility/range-alter-by-step.html:
  • accessibility/spinbutton-value-expected.txt:
  • accessibility/spinbutton-value.html:

Make tests async so they pass in isolated tree mode.
Minor updates to expectations:

  • Some variables renamed for better readability
  • Sometimes there is one more or one less newline after the test rewrites
  • resources/accessibility-helper.js:

(async waitForElementById): Added. Originally defined in
accessibility/ancestor-computation.html.
(async waitForExpression): Added.

Location:
trunk/LayoutTests
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285776 r285778  
     12021-11-13  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Make 7 more layout tests async so that they pass in --release --accessibility-isolated-tree mode
     4        https://bugs.webkit.org/show_bug.cgi?id=233085
     5
     6        Reviewed by Chris Fleizach.
     7
     8        This patch makes 7 more tests async so that they pass in --release
     9        --accessibility-isolated-tree mode. This patch also adds some helper
     10        functions to accessibility-helper.js.
     11
     12        * accessibility/ancestor-computation.html:
     13        Move `waitForElement` to accessibility-helpers.js and rename to
     14        `waitForElementById`.
     15
     16        * accessibility/color-well-expected.txt:
     17        * accessibility/color-well.html:
     18        * accessibility/mac/scrollbars.html:
     19        * accessibility/placeholder-expected.txt:
     20        * accessibility/placeholder.html:
     21        * accessibility/progressbar-expected.txt:
     22        * accessibility/progressbar.html:
     23        * accessibility/range-alter-by-percent-expected.txt:
     24        * accessibility/range-alter-by-percent.html:
     25        * accessibility/range-alter-by-step-expected.txt:
     26        * accessibility/range-alter-by-step.html:
     27        * accessibility/spinbutton-value-expected.txt:
     28        * accessibility/spinbutton-value.html:
     29        Make tests async so they pass in isolated tree mode.
     30        Minor updates to expectations:
     31          - Some variables renamed for better readability
     32          - Sometimes there is one more or one less newline after the test rewrites
     33
     34        * resources/accessibility-helper.js:
     35        (async waitForElementById): Added. Originally defined in
     36        accessibility/ancestor-computation.html.
     37        (async waitForExpression): Added.
     38
    1392021-11-13  Tyler Wilcock  <tyler_w@apple.com>
    240
  • trunk/LayoutTests/accessibility/ancestor-computation.html

    r285589 r285778  
    5454    var element;
    5555
    56     async function waitForElement(id) {
    57         let returnElement;
    58         await waitFor(() => {
    59             returnElement = accessibilityController.accessibleElementById(id);
    60             return returnElement;
    61         });
    62         return returnElement;
    63     }
    64 
    6556    async function shouldBeForAllDescendants(startElementId, expectedPropertyValues) {
    6657        debug(`Verifying ${JSON.stringify(expectedPropertyValues)} for all descendants of ${startElementId}.`);
    6758
    68         let elementsToCheck = [await waitForElement(startElementId)];
     59        let elementsToCheck = [await waitForElementById(startElementId)];
    6960        while (elementsToCheck.length) {
    7061            element = elementsToCheck.pop();
  • trunk/LayoutTests/accessibility/color-well-expected.txt

    r267644 r285778  
    1 
    21This test checks the role of ColorWellRolean input with type=color
    32
  • trunk/LayoutTests/accessibility/color-well.html

    r155274 r285778  
    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<body>
    78
    8     <input id="empty_colorwell" type="color">
    9     <input id="good_colorwell" type="color" value="#ff0000">
    10     <input id="bad_colorwell" type="color" value="purple">
     9<input id="empty_colorwell" type="color">
     10<input id="good_colorwell" type="color" value="#ff0000">
     11<input id="bad_colorwell" type="color" value="purple">
    1112   
    12     <p id="description"></p>
    13     <div id="console"></div>
    14      
    15     <script>
    16         if (window.accessibilityController) {
    17             description("This test checks the role of ColorWellRolean input with type=color");
     13<script>
     14    description("This test checks the role of ColorWellRolean input with type=color");
    1815
    19             var colorwell = document.getElementById("empty_colorwell").focus();
    20             var axColorwell = accessibilityController.focusedElement;
     16    if (window.accessibilityController) {
     17        window.jsTestIsAsync = true;
     18
     19        setTimeout(async function() {
     20            let axColorwell = await waitForElementById("empty_colorwell");
    2121            debug("Role of input type=color is: " + axColorwell.role);
    22 
    2322            debug("Value of empty color well: " + axColorwell.stringValue);
    2423
    25             colorwell = document.getElementById("good_colorwell").focus();
    26             axColorwell = accessibilityController.focusedElement;
     24            axColorwell = await waitForElementById("good_colorwell");
    2725            debug("Value of good color well: " + axColorwell.stringValue);
    2826
    29             colorwell = document.getElementById("bad_colorwell").focus();
    30             axColorwell = accessibilityController.focusedElement;
     27            axColorwell = await waitForElementById("bad_colorwell");
    3128            debug("Value of bad color well: " + axColorwell.stringValue);
    32         }
    33     </script>
    3429
    35 <script src="../resources/js-test-post.js"></script>
     30            finishJSTest();
     31        }, 0);
     32    }
     33</script>
     34</body>
     35</html>
    3636
    37 </body>
    38 </html>
  • trunk/LayoutTests/accessibility/mac/scrollbars.html

    r187799 r285778  
    22<html>
    33<head>
    4 <script>
    5 var successfullyParsed = false;
    6 </script>
    7 <script src="../../resources/js-test-pre.js"></script>
     4<script src="../../resources/js-test.js"></script>
     5<script src="../../resources/accessibility-helper.js"></script>
    86</head>
    9 <body id="body" tabindex="0">
    10 
    11 <p id="description"></p>
    12 <div id="console"></div>
    13 
    14 <div role="textbox" id="iframeGroup"></div>
     7<body id="body" role="group">
    158
    169<script>
    17 
    1810    description("This tests that a scroll area will return scroll bars when asked.");
    19 
    20    if (window.accessibilityController) {
    21         document.getElementById("body").focus();
    22         var body = accessibilityController.focusedElement;
    23     }
    2411
    2512    // Cause the web page to gain scrollbars.
     
    2815    }
    2916
    30      if (window.accessibilityController) {
    31           document.getElementById("body").focus();
    32           var body = accessibilityController.focusedElement;
     17    var scrollArea;
     18    if (window.accessibilityController) {
     19        window.jsTestIsAsync = true;
    3320
    34           var scrollArea = body.parentElement();
    35           shouldBe("scrollArea.role", "'AXRole: AXScrollArea'");
    36           shouldBe("scrollArea.verticalScrollbar.role", "'AXRole: AXScrollBar'");
     21        setTimeout(async function() {
     22            // Iterate up from the body AX element to the scrollarea AX element.
     23            let maybeScrollArea = (await waitForElementById("body")).parentElement();
     24            await waitFor(() => {
     25                if (maybeScrollArea && maybeScrollArea.role === "AXRole: AXScrollArea") {
     26                    scrollArea = maybeScrollArea;
     27                    return true;
     28                }
     29
     30                maybeScrollArea = maybeScrollArea.parentElement();
     31                return false;
     32            });
     33
     34            shouldBe("scrollArea.role", "'AXRole: AXScrollArea'");
     35            shouldBe("scrollArea.verticalScrollbar.role", "'AXRole: AXScrollBar'");
     36
     37            finishJSTest();
     38        }, 0);
    3739    }
    38 
    39     successfullyParsed = true;
    4040</script>
    41 
    42 <script src="../../resources/js-test-post.js"></script>
    4341</body>
    4442</html>
     43
  • trunk/LayoutTests/accessibility/placeholder-expected.txt

    r207014 r285778  
    1    Birthday:
    2 03-14-1879
    3 
    41This test makes sure that the placeholder is returned as the correct attribute
    52
     
    85
    96PASS fieldElement.stringAttributeValue('AXPlaceholderValue') is 'search'
    10 PASS pass.stringAttributeValue('AXPlaceholderValue') is 'Password'
    11 PASS search.stringAttributeValue('AXPlaceholderValue') is 'MM-DD-YYYY'
    12 PASS input.stringAttributeValue('AXPlaceholderValue') is 'Fill in the blank'
     7PASS passwordElement.stringAttributeValue('AXPlaceholderValue') is 'Password'
     8PASS searchElement.stringAttributeValue('AXPlaceholderValue') is 'MM-DD-YYYY'
     9PASS textInput.stringAttributeValue('AXPlaceholderValue') is 'Fill in the blank'
    1310PASS successfullyParsed is true
    1411
    1512TEST COMPLETE
     13   Birthday:
     1403-14-1879
    1615
  • trunk/LayoutTests/accessibility/placeholder.html

    r207014 r285778  
    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     <input placeholder="search" type="text" name="q" size="15" maxlength="255" id="searchterm" />
     7<body>
    98
    10     <input id="password" class="field" type="password" name="sc1798" value="" placeholder="Password" spellcheck="true" maxlength="5096">
     9<input placeholder="search" type="text" name="q" size="15" maxlength="255" id="searchterm" />
     10
     11<input id="password" class="field" type="password" name="sc1798" value="" placeholder="Password" spellcheck="true" maxlength="5096">
     12
     13<span id="label">Birthday:</span>
     14<div id="search" role="searchbox" aria-labelledby="label" aria-placeholder="MM-DD-YYYY">03-14-1879</div>
     15
     16<input type="text" id="input" placeholder="Fill in the blank" aria-placeholder="aria placeholder">
    1117   
    12     <span id="label">Birthday:</span>
    13     <div id="search" role="searchbox" aria-labelledby="label" aria-placeholder="MM-DD-YYYY">03-14-1879</div>
    14    
    15     <input type="text" id="input" placeholder="Fill in the blank" aria-placeholder="aria placeholder">
    16    
    17     <p id="description"></p>
    18     <div id="console"></div>
    19      
    20     <script>
    21         if (window.accessibilityController) {
    22             description("This test makes sure that the placeholder is returned as the correct attribute");
     18<script>
     19    description("This test makes sure that the placeholder is returned as the correct attribute");
    2320
    24             var field = document.getElementById("searchterm").focus();
    25             var fieldElement = accessibilityController.focusedElement;
     21    var fieldElement, passwordElement, searchElement, textInput;
     22    if (window.accessibilityController) {
     23        window.jsTestIsAsync = true;
     24
     25        setTimeout(async function() {
     26            fieldElement = await waitForElementById("searchterm");
    2627            shouldBe("fieldElement.stringAttributeValue('AXPlaceholderValue')", "'search'");
    2728
    28             document.getElementById("password").focus();
    29             var pass = accessibilityController.focusedElement;
    30             shouldBe("pass.stringAttributeValue('AXPlaceholderValue')", "'Password'");
     29            passwordElement = await waitForElementById("password");
     30            shouldBe("passwordElement.stringAttributeValue('AXPlaceholderValue')", "'Password'");
    3131           
    32             var search = accessibilityController.accessibleElementById("search");
    33             shouldBe("search.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
     32            searchElement = await waitForElementById("search");
     33            shouldBe("searchElement.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
    3434           
    3535            // When the placeholder and aria-placeholder attributes are both present, use the placeholder
    3636            // attribute's value.
    37             var input = accessibilityController.accessibleElementById("input");
    38             shouldBe("input.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
    39         }
    40     </script>
     37            textInput = await waitForElementById("input");
     38            shouldBe("textInput.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
    4139
    42 <script src="../resources/js-test-post.js"></script>
     40            finishJSTest();
     41        }, 0);
     42    }
     43</script>
    4344</body>
    4445</html>
     46
  • trunk/LayoutTests/accessibility/progressbar-expected.txt

    r267644 r285778  
    1 X X
    21This test makes sure that progress element can be accessed by Accessibility FW.
    32
     
    54
    65
    7 PASS obj.intValue is 7
    8 PASS obj.intValue is 5
    9 PASS obj.intValue is 7
    10 PASS obj.role is 'AXRole: AXProgressIndicator'
    11 PASS obj.intValue is 0
    12 PASS obj.role is 'AXRole: AXProgressIndicator'
     6PASS progressbar1.intValue is 7
     7PASS progressbar2.intValue is 5
     8PASS progressbar3.intValue is 7
     9PASS progressbar3.role is 'AXRole: AXProgressIndicator'
     10PASS progressbar4.intValue is 0
     11PASS progressbar4.role is 'AXRole: AXProgressIndicator'
    1312PASS successfullyParsed is true
    1413
    1514TEST COMPLETE
    16 
     15X X
  • trunk/LayoutTests/accessibility/progressbar.html

    r208739 r285778  
    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
    89<span tabindex="0" role="progressbar" id="progressbar1" aria-valuenow=7 aria-valuemin=0 aria-valuemax=10>X</span>
     
    1213<progress tabindex="0" id="progressbar4"></progress>
    1314
    14 <p id="description"></p>
    15 <div id="console"></div>
    16 
    1715<script>
    18 
    1916    description("This test makes sure that progress element can be accessed by Accessibility FW.");
    2017
     18    var progressbar1, progressbar2, progressbar3, progressbar4;
    2119    if (window.accessibilityController) {
     20        window.jsTestIsAsync = true;
    2221
    23           // ARIA determinate progressbar
    24           document.getElementById("progressbar1").focus();
    25           var obj = accessibilityController.focusedElement;
     22        setTimeout(async function() {
     23            // ARIA determinate progressbar
     24            progressbar1 = await waitForElementById("progressbar1");
     25            await waitForExpression(progressbar1, "intValue", 7);
     26            shouldBe("progressbar1.intValue", "7");
    2627
    27           shouldBe("obj.intValue", "7");
     28            // ARIA indeterminate progressbar
     29            progressbar2 = await waitForElementById("progressbar2");
     30            await waitForExpression(progressbar2, "intValue", 5);
     31            shouldBe("progressbar2.intValue", "5");
    2832
    29           // ARIA indeterminate progressbar
    30           document.getElementById("progressbar2").focus();
    31           var obj = accessibilityController.focusedElement;
     33            // Determinate progress element
     34            progressbar3 = await waitForElementById("progressbar3");
     35            await waitForExpression(progressbar3, "intValue", 7);
     36            shouldBe("progressbar3.intValue", "7");
     37            shouldBe("progressbar3.role", "'AXRole: AXProgressIndicator'");
    3238
    33           shouldBe("obj.intValue", "5");
     39            // Indeterminate progress element
     40            progressbar4 = await waitForElementById("progressbar4");
     41            await waitForExpression(progressbar4, "intValue", 0);
     42            shouldBe("progressbar4.intValue", "0");
     43            shouldBe("progressbar4.role", "'AXRole: AXProgressIndicator'");
    3444
    35           // determinate progress element
    36           document.getElementById("progressbar3").focus();
    37           var obj = accessibilityController.focusedElement;
    38 
    39           shouldBe("obj.intValue", "7");
    40           shouldBe("obj.role", "'AXRole: AXProgressIndicator'");
    41 
    42           // indeterminate progress element
    43           document.getElementById("progressbar4").focus();
    44           var obj = accessibilityController.focusedElement;
    45 
    46           shouldBe("obj.intValue", "0");
    47           shouldBe("obj.role", "'AXRole: AXProgressIndicator'");
     45            finishJSTest();
     46        }, 0);
    4847    }
    49 
    5048</script>
    51 
    52 <script src="../resources/js-test-post.js"></script>
    5349</body>
    5450</html>
     51
     52
     53
  • trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt

    r267644 r285778  
    1 
    21This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.
    32
  • trunk/LayoutTests/accessibility/range-alter-by-percent.html

    r162587 r285778  
    1 <!DOCTYPE html>
     1
     2<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    23<html>
    34<head>
    4 <script src="../resources/js-test-pre.js"></script>
     5<script src="../resources/js-test.js"></script>
     6<script src="../resources/accessibility-helper.js"></script>
    57<title>Range Alter by Percent</title>
    68</head>
     
    1416<input id="smallRange" max="10" min="0" type="range" value="5">
    1517
    16 <p id="description"></p>
    17 <div id="console"></div>
    18 
    1918<script>
    2019    description("This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.");
    21    
     20
     21    var smallRange, largeRange;
    2222    if (window.accessibilityController) {
    23         // Large range.
    24         var largeRange = accessibilityController.accessibleElementById("largeRange");
    25         shouldBe("largeRange.intValue", "50");
    26         largeRange.increment();
    27         shouldBe("largeRange.intValue", "55");
    28         largeRange.increment();
    29         shouldBe("largeRange.intValue", "60");
    30         largeRange.decrement();
    31         shouldBe("largeRange.intValue", "55");
    32         largeRange.decrement();
    33         shouldBe("largeRange.intValue", "50");
    34        
    35         // Small range.
    36         var smallRange = accessibilityController.accessibleElementById("smallRange");
    37         shouldBe("smallRange.intValue", "5");
    38         smallRange.increment();
    39         shouldBe("smallRange.intValue", "6");
    40         smallRange.increment();
    41         shouldBe("smallRange.intValue", "7");
    42         smallRange.decrement();
    43         shouldBe("smallRange.intValue", "6");
    44         smallRange.decrement();
    45         shouldBe("smallRange.intValue", "5");
     23        window.jsTestIsAsync = true;
     24
     25        setTimeout(async function() {
     26            largeRange = await waitForElementById("largeRange");
     27            await waitForExpression(largeRange, "intValue", 50);
     28            shouldBe("largeRange.intValue", "50");
     29            largeRange.increment();
     30            await waitForExpression(largeRange, "intValue", 55);
     31            shouldBe("largeRange.intValue", "55");
     32            largeRange.increment();
     33            await waitForExpression(largeRange, "intValue", 60);
     34            shouldBe("largeRange.intValue", "60");
     35            largeRange.decrement();
     36            await waitForExpression(largeRange, "intValue", 55);
     37            shouldBe("largeRange.intValue", "55");
     38            largeRange.decrement();
     39            await waitForExpression(largeRange, "intValue", 50);
     40            shouldBe("largeRange.intValue", "50");
     41
     42            smallRange = await waitForElementById("smallRange");
     43            await waitForExpression(smallRange, "intValue", 5);
     44            shouldBe("smallRange.intValue", "5");
     45            smallRange.increment();
     46            await waitForExpression(smallRange, "intValue", 6);
     47            shouldBe("smallRange.intValue", "6");
     48            smallRange.increment();
     49            await waitForExpression(smallRange, "intValue", 7);
     50            shouldBe("smallRange.intValue", "7");
     51            smallRange.decrement();
     52            await waitForExpression(smallRange, "intValue", 6);
     53            shouldBe("smallRange.intValue", "6");
     54            smallRange.decrement();
     55            await waitForExpression(smallRange, "intValue", 5);
     56            shouldBe("smallRange.intValue", "5");
     57
     58            finishJSTest();
     59        }, 0);
    4660    }
    4761</script>
    48 
    49 <script src="../resources/js-test-post.js"></script>
    5062</body>
    5163</html>
  • trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt

    r155444 r285778  
    1 
    21This test makes sure that if a range type has a step value, that increment and decrement work.
    32
     
    54
    65
    7 PASS obj.intValue is 25
    8 PASS obj.intValue is 50
    9 PASS obj.intValue is 75
    10 PASS obj.intValue is 100
    11 PASS obj.intValue is 100
    12 PASS obj.intValue is 75
    13 PASS obj.intValue is 50
    14 PASS obj.intValue is 25
    15 PASS obj.intValue is 0
    16 PASS obj.intValue is 0
     6PASS rangeInput.intValue is 25
     7PASS rangeInput.intValue is 50
     8PASS rangeInput.intValue is 75
     9PASS rangeInput.intValue is 100
     10PASS rangeInput.intValue is 100
     11PASS rangeInput.intValue is 75
     12PASS rangeInput.intValue is 50
     13PASS rangeInput.intValue is 25
     14PASS rangeInput.intValue is 0
     15PASS rangeInput.intValue is 0
    1716PASS successfullyParsed is true
    1817
  • trunk/LayoutTests/accessibility/range-alter-by-step.html

    r155444 r285778  
    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 <input type="range" min="0" max="100" value="25" step="25" id="range1"/>
    9 
    10 <p id="description"></p>
    11 <div id="console"></div>
     9<input type="range" min="0" max="100" value="25" step="25" id="rangeInput"/>
    1210
    1311<script>
    14 
    1512    description("This test makes sure that if a range type has a step value, that increment and decrement work.");
    1613
    17     if (window.accessibilityController) {
    18 
    19           // ARIA determinate progressbar
    20           document.getElementById("range1").focus();
    21           var obj = accessibilityController.focusedElement;
    22          
    23           shouldBe("obj.intValue", "25");
    24 
    25           obj.increment();
    26           shouldBe("obj.intValue", "50");
    27 
    28           obj.increment();
    29           shouldBe("obj.intValue", "75");
    30 
    31           obj.increment();
    32           shouldBe("obj.intValue", "100");
    33 
    34           obj.increment();
    35           shouldBe("obj.intValue", "100");
    36 
    37           obj.decrement();
    38           shouldBe("obj.intValue", "75");
    39 
    40           obj.decrement();
    41           shouldBe("obj.intValue", "50");
    42 
    43           obj.decrement();
    44           shouldBe("obj.intValue", "25");
    45 
    46           obj.decrement();
    47           shouldBe("obj.intValue", "0");
    48 
    49           obj.decrement();
    50           shouldBe("obj.intValue", "0");
     14    var rangeInput;
     15    async function waitForAndExpectIntValue(expectedIntValue) {
     16        await waitForExpression(rangeInput, "intValue", expectedIntValue);
     17        shouldBe("rangeInput.intValue", `${expectedIntValue}`)
    5118    }
    5219
     20    if (window.accessibilityController) {
     21        window.jsTestIsAsync = true;
     22
     23        setTimeout(async function() {
     24            // ARIA determinate progressbar
     25            rangeInput = await waitForElementById("rangeInput");
     26            await waitForAndExpectIntValue(25);
     27
     28            rangeInput.increment();
     29            await waitForAndExpectIntValue(50);
     30
     31            rangeInput.increment();
     32            await waitForAndExpectIntValue(75);
     33
     34            rangeInput.increment();
     35            await waitForAndExpectIntValue(100);
     36
     37            rangeInput.increment();
     38            await waitForAndExpectIntValue(100);
     39
     40            rangeInput.decrement();
     41            await waitForAndExpectIntValue(75);
     42
     43            rangeInput.decrement();
     44            await waitForAndExpectIntValue(50);
     45
     46            rangeInput.decrement();
     47            await waitForAndExpectIntValue(25);
     48
     49            rangeInput.decrement();
     50            await waitForAndExpectIntValue(0);
     51
     52            rangeInput.decrement();
     53            await waitForAndExpectIntValue(0);
     54
     55            finishJSTest();
     56        }, 0);
     57    }
    5358</script>
    54 
    55 <script src="../resources/js-test-post.js"></script>
    5659</body>
    5760</html>
     61
  • trunk/LayoutTests/accessibility/spinbutton-value-expected.txt

    r127882 r285778  
    1 
    2 42
    31This tests that a spin button supports range value attributes.
    42
     
    64
    75
    8 PASS endsWith(axSpin.intValue, '5') is true
    9 PASS endsWith(axSpin.minValue, '1') is true
    10 PASS endsWith(axSpin.maxValue, '9') is true
    11 PASS endsWith(axSpin.valueDescription, '5 of 9') is true
    12 PASS axSpin.title is axUntitled.title
     6PASS endsWith(spinbutton.intValue, '5') is true
     7PASS endsWith(spinbutton.minValue, '1') is true
     8PASS endsWith(spinbutton.maxValue, '9') is true
     9PASS endsWith(spinbutton.valueDescription, '5 of 9') is true
     10PASS spinbutton.title is untitledButton.title
    1311PASS successfullyParsed is true
    1412
    1513TEST COMPLETE
    1614
     1542
  • trunk/LayoutTests/accessibility/spinbutton-value.html

    r217171 r285778  
    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.js"></script>
    58
    6 <button id="untitled"></button>
     9<button id="untitledButton"></button>
    710
    8 <div id="spin"
     11<div id="spinbutton"
    912     tabindex="0"
    1013     role="spinbutton"
     
    1417     aria-valuenow="5">42</div>
    1518
    16 <div id="console"></div>
    1719<script>
    18 description("This tests that a spin button supports range value attributes.")
     20    description("This tests that a spin button supports range value attributes.");
    1921
    20 if (window.testRunner && window.accessibilityController) {
    2122    function endsWith(str, suffix) {
    22         str = '' + str;
     23        str = "" + str;
    2324        return str.substr(str.length - suffix.length) == suffix;
    2425    }
    2526
    26     var untitled = document.getElementById('untitled');
    27     untitled.focus();
    28     window.axUntitled = accessibilityController.focusedElement;
     27    var spinbutton, untitledButton;
     28    if (window.accessibilityController) {
     29        window.jsTestIsAsync = true;
    2930
    30     var spin = document.getElementById('spin');
    31     spin.focus();
    32     window.axSpin = accessibilityController.focusedElement;
     31        setTimeout(async function() {
     32            untitledButton = await waitForElementById("untitledButton");
     33            spinbutton = await waitForElementById("spinbutton");
     34            await waitForExpression(spinbutton, "intValue", 5);
    3335
    34     // Test range value attributes.
    35     shouldBe("endsWith(axSpin.intValue, '5')", "true");
    36     shouldBe("endsWith(axSpin.minValue, '1')", "true");
    37     shouldBe("endsWith(axSpin.maxValue, '9')", "true");
    38     shouldBe("endsWith(axSpin.valueDescription, '5 of 9')", "true");
     36            // Test range value attributes.
     37            shouldBe("endsWith(spinbutton.intValue, '5')", "true");
     38            shouldBe("endsWith(spinbutton.minValue, '1')", "true");
     39            shouldBe("endsWith(spinbutton.maxValue, '9')", "true");
     40            shouldBe("endsWith(spinbutton.valueDescription, '5 of 9')", "true");
    3941
    40     // Make sure the title doesn't come from the inner text. It should just be empty if
    41     // not otherwise specified.
    42     shouldBe("axSpin.title", "axUntitled.title");
    43 }
     42            // Make sure the title doesn't come from the inner text. It should just be empty if
     43            // not otherwise specified.
     44            shouldBe("spinbutton.title", "untitledButton.title");
    4445
     46            finishJSTest();
     47        }, 0);
     48    }
    4549</script>
    4650</body>
    4751</html>
     52
  • trunk/LayoutTests/resources/accessibility-helper.js

    r265248 r285778  
    111111    });
    112112}
     113
     114async function waitForElementById(id) {
     115    let element;
     116    await waitFor(() => {
     117        element = accessibilityController.accessibleElementById(id);
     118        return element;
     119    });
     120    return element;
     121}
     122
     123async function waitForExpression(element, expression, expectedValue) {
     124    if (typeof expression !== "string")
     125        debug("WARN: The expression arg in waitForExpression() should be a string.");
     126
     127    await waitFor(() => {
     128        return eval(`element.${expression} === ${expectedValue}`);
     129    });
     130}
     131
Note: See TracChangeset for help on using the changeset viewer.