[GTK][WPE] Fix non-unified builds after r250857
[WebKit-https.git] / LayoutTests / fast / events / input-events-fired-when-typing.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3
4 <head>
5     <script src="../../resources/js-test-pre.js"></script>
6     <script>
7         var expectedTargetID = "foo";
8
9         function contentEditable()
10         {
11             return document.querySelector("#foo");
12         }
13
14         function plainText()
15         {
16             return document.querySelector("#bar");
17         }
18
19         function beginTest()
20         {
21             if (!window.eventSender || !window.internals || !window.testRunner)
22                 return;
23
24             internals.settings.setInputEventsEnabled(true);
25             testRunner.dumpAsText();
26             contentEditable().focus();
27             eventSender.keyDown("a", []);
28
29             expectedTargetID = "bar";
30             plainText().focus();
31             eventSender.keyDown("b", []);
32         }
33
34         function checkInputEvent(event)
35         {
36             debug("Fired `oninput`!");
37             shouldBeDefined("event.__lookupGetter__('inputType')");
38             shouldBeDefined("event.__lookupGetter__('data')");
39             shouldBeDefined("event.__lookupGetter__('dataTransfer')");
40             shouldBeDefined("event.getTargetRanges");
41             shouldBe("event.target.id", "expectedTargetID");
42             shouldBe("event.bubbles", "true");
43             shouldBe("event.cancelable", "false");
44             shouldBe("event.composed", "true");
45         }
46
47         function checkBeforeInputEvent(event)
48         {
49             debug("Fired `onbeforeinput`!");
50             shouldBeDefined("event.__lookupGetter__('inputType')");
51             shouldBeDefined("event.__lookupGetter__('data')");
52             shouldBeDefined("event.__lookupGetter__('dataTransfer')");
53             shouldBeDefined("event.getTargetRanges");
54             shouldBe("event.target.id", "expectedTargetID");
55             shouldBe("event.bubbles", "true");
56             shouldBe("event.cancelable", "true");
57             shouldBe("event.composed", "true");
58         }
59     </script>
60 </head>
61
62 <body onload=beginTest()>
63     <div id="foo" contenteditable oninput=checkInputEvent(event) onbeforeinput=checkBeforeInputEvent(event)></div>
64     <input id="bar" oninput=checkInputEvent(event) onbeforeinput=checkBeforeInputEvent(event)></input>
65     <script src="../../resources/js-test-post.js"></script>
66 </body>
67
68 </html>