webkitpy: Implement device type specific expected results (Part 2)
[WebKit-https.git] / LayoutTests / platform / ipad / fast / forms / choose-select-option.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
3 <html>
4 <head>
5     <meta name="viewport" content="width=device-width">
6     <style>
7     </style>
8     
9     <script src="../../../../fast/forms/ios/resources/zooming-test-utils.js"></script>
10     <script>
11     if (window.testRunner) {
12         testRunner.dumpAsText();
13         testRunner.waitUntilDone();
14     }
15
16     var uiScriptHasCompleted = false;
17     var oninputHasBeenHandled = false;
18
19     function getTapOnSelectUIScript(x, y)
20     {
21         return `
22             (function() {
23                 uiController.singleTapAtPoint(${x}, ${y}, function() {
24                     uiController.uiScriptComplete('');
25                 });
26             })();`
27     }
28
29     function getUIScriptForSelectRow()
30     {
31         return `
32             (function() {
33                 uiController.selectFormAccessoryPickerRow(3);
34             })();`
35     }
36     
37     function checkDone()
38     {
39         if (oninputHasBeenHandled && uiScriptHasCompleted)
40             testRunner.notifyDone();
41     }
42
43     function handleValueChanged(value)
44     {
45         document.getElementById("console").textContent = "Successfully handled oninput, value is now \"" + value.toLowerCase() + "\"";
46         oninputHasBeenHandled = true;
47         checkDone();
48     }
49     
50     function doTest()
51     {
52         if (!window.testRunner || !testRunner.runUIScript)
53             return;
54
55         var targetElement = document.getElementsByTagName('select')[0];
56         var point = getPointInsideElement(targetElement, 10, 10);
57
58         testRunner.runUIScript(getTapOnSelectUIScript(point.x, point.y), function() {
59             testRunner.runUIScript(getUIScriptForSelectRow(), function() {
60                 uiScriptHasCompleted = true;
61                 checkDone();
62             });
63         });
64     }
65
66     window.addEventListener('load', doTest, false);
67     </script>
68 </head>
69 <body>
70
71 <p>Tests that a basic select element works</p>
72
73 <select oninput="handleValueChanged(this.value)">
74     <option>January</option>
75     <option>February</option>
76     <option>March</option>
77     <option>April</option>
78     <option>May</option>
79     <option>June</option>
80     <option>July</option>
81     <option>August</option>
82     <option>September</option>
83     <option>October</option>
84     <option>November</option>
85     <option>December</option>
86 </select>
87
88 <div id="console">Failed to handle oninput<div>
89
90 </body>
91 </html>