7b0766b214c72f9cf2b85e967fad4f1f052c84bc
[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         var button = accessibilityController.accessibleElementById("search").childAtIndex(1);
19         
20         shouldBe("button.description", "'AXDescription: cancel'");
21         shouldBe("button.role", "'AXRole: AXButton'");
22         shouldBe("button.roleDescription", "'AXRoleDescription: button'");
23         
24         // Search field has value before press.
25         shouldBe("document.getElementById('search').value", "'X'");
26         
27         button.press();
28         
29         // Search field has no value after press.
30         shouldBe("document.getElementById('search').value", "''");
31     }
32 </script>
33
34 <script src="../../resources/js-test-post.js"></script>
35 </body>
36 </html>