| 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 // Creating UIEvent. |
| 5 var uievent = document.createEvent('UIEvent'); | 6 var uievent = document.createEvent('UIEvent'); |
| 6 shouldBeNonNull("uievent"); | 7 shouldBeNonNull("uievent"); |
| 7 shouldBeNull("uievent.sourceDevice"); | 8 shouldBeNull("uievent.sourceDevice"); |
| 8 | 9 |
| 9 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: false }) }); | 10 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: false }) }); |
| 10 shouldBeNonNull("uievent.sourceDevice"); | 11 shouldBeNonNull("uievent.sourceDevice"); |
| 11 shouldBeFalse("uievent.sourceDevice.firesTouchEvents"); | 12 shouldBeFalse("uievent.sourceDevice.firesTouchEvents"); |
| 12 | 13 |
| 13 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: true }) }); | 14 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo
uchEvents: true }) }); |
| 14 shouldBeNonNull("uievent.sourceDevice"); | 15 shouldBeNonNull("uievent.sourceDevice"); |
| 15 shouldBeTrue("uievent.sourceDevice.firesTouchEvents"); | 16 shouldBeTrue("uievent.sourceDevice.firesTouchEvents"); |
| 16 | 17 |
| 18 // Creating TouchEvent. |
| 17 var touchevent = document.createEvent("TouchEvent"); | 19 var touchevent = document.createEvent("TouchEvent"); |
| 18 shouldBeNonNull("touchevent"); | 20 shouldBeNonNull("touchevent"); |
| 19 shouldBeNull("touchevent.sourceDevice"); | 21 shouldBeNull("touchevent.sourceDevice"); |
| 22 |
| 23 // Creating MouseEvent. |
| 24 var mouseevent = new MouseEvent('mousedown'); |
| 25 shouldBeNonNull("mouseevent"); |
| 26 shouldBeNull("mouseevent.sourceDevice"); |
| 27 |
| 28 var mouseevent = new MouseEvent('mousedown', { sourceDevice: new InputDevice
({ firesTouchEvents: false }) }); |
| 29 shouldBeNonNull("mouseevent.sourceDevice"); |
| 30 shouldBeFalse("mouseevent.sourceDevice.firesTouchEvents"); |
| 20 | 31 |
| 21 </script> | 32 </script> |
| OLD | NEW |