OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 description('Tests the optional properties of DeviceOrientationEvent. Each prope
rty should be null if not set, or set to null or undefined.'); | 6 description('Tests the optional properties of DeviceOrientationEvent. Each prope
rty should be null if not set, or set to null or undefined.'); |
7 | 7 |
8 var event; | 8 var event; |
9 | 9 |
10 evalAndLog("event = document.createEvent('DeviceOrientationEvent')"); | 10 evalAndLog("event = document.createEvent('DeviceOrientationEvent')"); |
11 shouldBeTrue("event.alpha == null"); | 11 shouldBeTrue("event.alpha == null"); |
12 shouldBeTrue("event.beta == null"); | 12 shouldBeTrue("event.beta == null"); |
13 shouldBeTrue("event.gamma == null"); | 13 shouldBeTrue("event.gamma == null"); |
14 shouldBeFalse("event.absolute"); | 14 shouldBeFalse("event.absolute"); |
15 | 15 |
16 evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2, false)")
; | 16 evalAndLog("event = new DeviceOrientationEvent('', {alpha: 0, beta: 1, gamma: 2,
absolute: false})"); |
17 shouldBeTrue("event.alpha == 0"); | 17 shouldBeTrue("event.alpha == 0"); |
18 shouldBeTrue("event.beta == 1"); | 18 shouldBeTrue("event.beta == 1"); |
19 shouldBeTrue("event.gamma == 2"); | 19 shouldBeTrue("event.gamma == 2"); |
20 shouldBeFalse("event.absolute"); | 20 shouldBeFalse("event.absolute"); |
21 | 21 |
22 evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2, true)"); | 22 evalAndLog("event = new DeviceOrientationEvent('', {alpha: 0, beta: 1, gamma: 2,
absolute: true})"); |
23 shouldBeTrue("event.alpha == 0"); | 23 shouldBeTrue("event.alpha == 0"); |
24 shouldBeTrue("event.beta == 1"); | 24 shouldBeTrue("event.beta == 1"); |
25 shouldBeTrue("event.gamma == 2"); | 25 shouldBeTrue("event.gamma == 2"); |
26 shouldBeTrue("event.absolute"); | 26 shouldBeTrue("event.absolute"); |
27 | 27 |
28 evalAndLog("event.initDeviceOrientationEvent()"); | 28 evalAndLog("event = new DeviceOrientationEvent('')"); |
29 shouldBeTrue("event.alpha == null"); | 29 shouldBeTrue("event.alpha == null"); |
30 shouldBeTrue("event.beta == null"); | 30 shouldBeTrue("event.beta == null"); |
31 shouldBeTrue("event.gamma == null"); | 31 shouldBeTrue("event.gamma == null"); |
32 shouldBeFalse("event.absolute"); | 32 shouldBeFalse("event.absolute"); |
33 | 33 |
34 evalAndLog("event.initDeviceOrientationEvent('', false, false, [], [], [], [])")
; | 34 evalAndLog("event = new DeviceOrientationEvent('', {alpha: [], beta: [], gamma:
[], absolute: []})"); |
35 shouldBeTrue("event.alpha == 0"); | 35 shouldBeTrue("event.alpha == 0"); |
36 shouldBeTrue("event.beta == 0"); | 36 shouldBeTrue("event.beta == 0"); |
37 shouldBeTrue("event.gamma == 0"); | 37 shouldBeTrue("event.gamma == 0"); |
38 shouldBeTrue("event.absolute"); | 38 shouldBeTrue("event.absolute"); |
39 | 39 |
40 evalAndLog("event.initDeviceOrientationEvent('', false, false, undefined, undefi
ned, undefined, undefined)"); | 40 evalAndLog("event = new DeviceOrientationEvent('', {alpha: undefined, beta: unde
fined, gamma: undefined, absolute: undefined})"); |
41 shouldBeTrue("event.alpha == null"); | 41 shouldBeTrue("event.alpha == null"); |
42 shouldBeTrue("event.beta == null"); | 42 shouldBeTrue("event.beta == null"); |
43 shouldBeTrue("event.gamma == null"); | 43 shouldBeTrue("event.gamma == null"); |
44 shouldBeFalse("event.absolute"); | 44 shouldBeFalse("event.absolute"); |
45 | 45 |
46 evalAndLog("event.initDeviceOrientationEvent('', false, false, '', '', '', '')")
; | 46 evalAndLog("event = new DeviceOrientationEvent('', {alpha: '', beta: '', gamma:
'', absolute: ''})"); |
47 shouldBeTrue("event.alpha == 0"); | 47 shouldBeTrue("event.alpha == 0"); |
48 shouldBeTrue("event.beta == 0"); | 48 shouldBeTrue("event.beta == 0"); |
49 shouldBeTrue("event.gamma == 0"); | 49 shouldBeTrue("event.gamma == 0"); |
50 shouldBeFalse("event.absolute"); | 50 shouldBeFalse("event.absolute"); |
51 | 51 |
52 evalAndLog("event.initDeviceOrientationEvent('', false, false, null, null, null,
null)"); | 52 evalAndLog("event = new DeviceOrientationEvent('', {alpha: null, beta: null, gam
ma: null, absolute: null})"); |
53 shouldBeTrue("event.alpha == null"); | 53 shouldBeTrue("event.alpha == null"); |
54 shouldBeTrue("event.beta == null"); | 54 shouldBeTrue("event.beta == null"); |
55 shouldBeTrue("event.gamma == null"); | 55 shouldBeTrue("event.gamma == null"); |
56 shouldBeFalse("event.absolute"); | 56 shouldBeFalse("event.absolute"); |
57 </script> | 57 </script> |
58 </body> | 58 </body> |
59 </html> | 59 </html> |
OLD | NEW |