AX: should dispatch accessibilityPerformPressAction async on MacOS
[WebKit-https.git] / LayoutTests / accessibility / mac / html5-input-number.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 </head>
6 <body id="body">
7
8 <form>
9 <input id="number" type="number"><br>
10 </form>
11
12 <p id="description"></p>
13 <div id="console"></div>
14
15 <script>
16
17     description("This tests that input type='number' exposes the accessibility of it's stepper correctly");
18
19     if (window.accessibilityController) {
20         window.jsTestIsAsync = true;
21         
22         document.getElementById("number").focus();
23         var textfield = accessibilityController.accessibleElementById("number");
24
25         // Verify that the click point is the same as the child.
26         shouldBe("textfield.childrenCount", "1");
27
28         var incrementor = textfield.childAtIndex(0);
29
30         shouldBe("incrementor.role", "'AXRole: AXIncrementor'");
31         shouldBeTrue("incrementor.width > 0");
32         shouldBeTrue("incrementor.height > 0");
33         shouldBe("incrementor.childrenCount", "2");
34
35         shouldBe("incrementor.childAtIndex(0).role", "'AXRole: AXButton'");
36         shouldBe("incrementor.childAtIndex(0).subrole", "'AXSubrole: AXIncrementArrow'");
37         shouldBeTrue("incrementor.childAtIndex(0).width > 0");
38         shouldBeTrue("incrementor.childAtIndex(0).height > 0");
39         shouldBeTrue("incrementor.childAtIndex(0).isEnabled");
40
41         // Increment.
42         incrementor.childAtIndex(0).press();
43         setTimeout(function() {
44             shouldBe("textfield.stringValue", "'AXValue: 1'");
45             shouldBe("incrementor.childAtIndex(1).role", "'AXRole: AXButton'");
46             shouldBe("incrementor.childAtIndex(1).subrole", "'AXSubrole: AXDecrementArrow'");
47             shouldBeTrue("incrementor.childAtIndex(1).width > 0");
48             shouldBeTrue("incrementor.childAtIndex(1).height > 0");
49             shouldBeTrue("incrementor.childAtIndex(1).isEnabled");
50             
51             // Decrement.
52             incrementor.childAtIndex(1).press();
53             setTimeout(function() {
54                 shouldBe("textfield.stringValue", "'AXValue: 0'");
55                 finishJSTest();
56             }, 10);
57         }, 10);
58     }
59
60 </script>
61
62 <script src="../../resources/js-test-post.js"></script>
63 </body>
64 </html>