Introduce InputEvent bindings in preparation for the input events spec
[WebKit-https.git] / LayoutTests / fast / events / ios / input-events-fired-when-typing-in-contenteditable.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
3 <html>
4
5 <head>
6     <script src="../../../resources/js-test-pre.js"></script>
7     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
8     <script id="ui-script" type="text/plain">
9         (function() {
10             uiController.didShowKeyboardCallback = function() {
11                 uiController.typeCharacterUsingHardwareKeyboard(" ", function() {
12                     uiController.uiScriptComplete();
13                 });
14             }
15             uiController.singleTapAtPoint(100, 100, function() {});
16         })();
17     </script>
18
19     <script>
20         var progress = 0;
21
22         if (window.testRunner) {
23             testRunner.dumpAsText();
24             testRunner.waitUntilDone();
25             internals.settings.setInputEventsEnabled(true);
26         }
27
28         function incrementProgress()
29         {
30             progress++;
31             if (progress == 2)
32                 testRunner.notifyDone();
33         }
34
35         function getUIScript()
36         {
37             return document.getElementById("ui-script").text;
38         }
39
40         function runTest()
41         {
42             if (!window.testRunner || !testRunner.runUIScript)
43                 return;
44
45             testRunner.runUIScript(getUIScript(), function(result) {
46                 incrementProgress();
47             });
48         }
49
50         function yesno(b) { return b ? "YES" : "NO"; }
51
52         function handleInput(event)
53         {
54             debug("Does the event have an inputType method? " + yesno(event.__lookupGetter__("inputType")));
55             debug("Does the event have InputEvent's prototype? " + yesno(Object.getPrototypeOf(event) === InputEvent.prototype));
56             debug("What is the event's id? " + event.target.id);
57             debug("Does the event bubble? " + yesno(event.bubbles));
58             debug("Is the event cancelable? " + yesno(event.cancelable));
59             debug("Is the event composed? " + yesno(event.composed));
60             incrementProgress();
61         }
62     </script>
63     <style>
64     #editable {
65         width: 100vw;
66         height: 100vh;
67     }
68     </style>
69 </head>
70
71 <body style="margin: 0;" onload=runTest()>
72     <div contenteditable id="editable" oninput=handleInput(event)>
73     <div id="console"></div>
74     <script src="../../../resources/js-test-post.js"></script>
75 </body>
76
77 </html>