Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / uievent-with-inputdevice.html
blobaa5a80b365a8c4a94eff57c2cebf89027a586692
1 <script src="../../resources/js-test.js"></script>
2 <script>
3 description("This tests that UIEvent and its subclass will have sourceCapabilities set to be null by default, and it can also be passed when initialization.")
5 // Creating UIEvent.
6 var uievent = document.createEvent('UIEvent');
7 shouldBeNonNull("uievent");
8 shouldBeNull("uievent.sourceCapabilities");
10 uievent = new UIEvent('eventType', { sourceCapabilities: new InputDeviceCapabilities({ firesTouchEvents: false }) });
11 shouldBeNonNull("uievent.sourceCapabilities");
12 shouldBeFalse("uievent.sourceCapabilities.firesTouchEvents");
14 uievent = new UIEvent('eventType', { sourceCapabilities: new InputDeviceCapabilities({ firesTouchEvents: true }) });
15 shouldBeNonNull("uievent.sourceCapabilities");
16 shouldBeTrue("uievent.sourceCapabilities.firesTouchEvents");
18 // Creating TouchEvent.
19 var touchevent = document.createEvent("TouchEvent");
20 shouldBeNonNull("touchevent");
21 shouldBeNull("touchevent.sourceCapabilities");
23 // Creating MouseEvent.
24 var mouseevent = new MouseEvent('mousedown');
25 shouldBeNonNull("mouseevent");
26 shouldBeNull("mouseevent.sourceCapabilities");
28 var mouseevent = new MouseEvent('mousedown', { sourceCapabilities: new InputDeviceCapabilities({ firesTouchEvents: false }) });
29 shouldBeNonNull("mouseevent.sourceCapabilities");
30 shouldBeFalse("mouseevent.sourceCapabilities.firesTouchEvents");
33 // Creating KeyboardEvent.
34 var keyboardevent = new KeyboardEvent("keydown");
35 shouldBeNonNull("keyboardevent");
36 shouldBeNull("keyboardevent.sourceCapabilities");
38 keyboardevent = new KeyboardEvent("keydown", { sourceCapabilities: new InputDeviceCapabilities({ firesTouchEvents: false }) });
39 shouldBeNonNull("keyboardevent.sourceCapabilities");
40 shouldBeFalse("keyboardevent.sourceCapabilities.firesTouchEvents");
42 // Creating FocusEvent.
43 var focusevent = new FocusEvent("focusevent");
44 shouldBeNonNull("focusevent");
45 shouldBeNull("focusevent.sourceCapabilities");
47 focusevent = new FocusEvent("focusevent", { sourceCapabilities: new InputDeviceCapabilities({ firesTouchEvents: false }) });
48 shouldBeNonNull("focusevent.sourceCapabilities");
49 shouldBeFalse("focusevent.sourceCapabilities.firesTouchEvents");
51 // Creating CompositionEvent.
52 var compositionevent = new CompositionEvent("compositionstart");
53 shouldBeNonNull("compositionevent");
54 shouldBeNull("compositionevent.sourceCapabilities");
56 compositionevent = new CompositionEvent("compositionstart", { sourceCapabilities: new InputDeviceCapabilities({ firesTouchEvents: false }) });
57 shouldBeNonNull("compositionevent.sourceCapabilities");
58 shouldBeFalse("compositionevent.sourceCapabilities.firesTouchEvents");
60 </script>