| OLD | NEW |
| 1 <script src="../../resources/js-test.js"></script> | 1 <script src="../../resources/js-test.js"></script> |
| 2 <script> | 2 <script> |
| 3 description("This tests that UIEvent and its subclass will have sourceDevice
set to be null by default, and it can also be passed when initialization.") | 3 description("This tests that UIEvent and its subclass will have sourceDevice
set to be null by default, and it can also be passed when initialization.") |
| 4 | 4 |
| 5 var uievent = document.createEvent('UIEvent'); | 5 var uievent = document.createEvent('UIEvent'); |
| 6 shouldBeNonNull("uievent"); | 6 shouldBeNonNull("uievent"); |
| 7 shouldBeNull("uievent.sourceDevice"); | 7 shouldBeNull("uievent.sourceDevice"); |
| 8 | 8 |
| 9 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: false }) }); | 9 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: false }) }); |
| 10 shouldBeNonNull("uievent.sourceDevice"); | 10 shouldBeNonNull("uievent.sourceDevice"); |
| 11 shouldBeFalse("uievent.sourceDevice.firesTouchEvents"); | 11 shouldBeFalse("uievent.sourceDevice.firesTouchEvents"); |
| 12 | 12 |
| 13 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: true }) }); | 13 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: true }) }); |
| 14 shouldBeNonNull("uievent.sourceDevice"); | 14 shouldBeNonNull("uievent.sourceDevice"); |
| 15 shouldBeTrue("uievent.sourceDevice.firesTouchEvents"); | 15 shouldBeTrue("uievent.sourceDevice.firesTouchEvents"); |
| 16 | 16 |
| 17 var touchevent = document.createEvent("TouchEvent"); | 17 var touchevent = document.createEvent("TouchEvent"); |
| 18 shouldBeNonNull("touchevent"); | 18 shouldBeNonNull("touchevent"); |
| 19 shouldBeNull("touchevent.sourceDevice"); | 19 shouldBeNull("touchevent.sourceDevice"); |
| 20 |
| 21 var keyboardevent = document.createEvent("KeyboardEvent"); |
| 22 shouldBeNonNull("keyboardevent"); |
| 23 shouldBeNull("keyboardevent.sourceDevice"); |
| 24 |
| 25 var sourceDevice = new InputDevice({ firesTouchEvents: false }); |
| 26 shouldBeFalse("sourceDevice.firesTouchEvents"); |
| 27 |
| 28 keyboardevent.initKeyboardEvent("keydown", true, true, null, 0, 0, false, fa
lse, false, false, sourceDevice); |
| 29 shouldBeNonNull("keyboardevent.sourceDevice"); |
| 30 shouldBeFalse("keyboardevent.sourceDevice.firesTouchEvents"); |
| 20 | 31 |
| 21 </script> | 32 </script> |
| OLD | NEW |