AX: should dispatch accessibilityPerformPressAction async on MacOS
[WebKit-https.git] / LayoutTests / accessibility / mac / search-field-cancel-button.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 <title>Search Field Cancel Button</title>
6 </head>
7 <body>
8
9 <input id="search" type="search" value="X">
10
11 <p id="description"></p>
12 <div id="console"></div>
13
14 <script>
15     description("This tests that the search field cancel button is exposed correctly.");
16     
17     if (window.accessibilityController) {
18         window.jsTestIsAsync = true;
19     
20         var button = accessibilityController.accessibleElementById("search").childAtIndex(1);
21         
22         shouldBe("button.description", "'AXDescription: cancel'");
23         shouldBe("button.role", "'AXRole: AXButton'");
24         shouldBe("button.roleDescription", "'AXRoleDescription: button'");
25         
26         // Search field has value before press.
27         shouldBe("document.getElementById('search').value", "'X'");
28         
29         button.press();
30         setTimeout(function() {
31             // Search field has no value after press.
32             shouldBe("document.getElementById('search').value", "''");
33             finishJSTest();
34         }, 10);
35     }
36 </script>
37
38 <script src="../../resources/js-test-post.js"></script>
39 </body>
40 </html>