summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js
blob: 2936e729cfef5923c0fb6f391729452b9cf4b96b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
description("Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined.");

var event;

evalAndLog("event = document.createEvent('DeviceOrientationEvent')");
shouldBeTrue("event.alpha == null");
shouldBeTrue("event.beta == null");
shouldBeTrue("event.gamma == null");

evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2)");
shouldBeTrue("event.alpha == 0");
shouldBeTrue("event.beta == 1");
shouldBeTrue("event.gamma == 2");

evalAndLog("event.initDeviceOrientationEvent()");
shouldBeTrue("event.alpha == null");
shouldBeTrue("event.beta == null");
shouldBeTrue("event.gamma == null");

evalAndLog("event.initDeviceOrientationEvent('', false, false, [], [], [])");
shouldBeTrue("event.alpha == 0");
shouldBeTrue("event.beta == 0");
shouldBeTrue("event.gamma == 0");

evalAndLog("event.initDeviceOrientationEvent('', false, false, undefined, undefined, undefined)");
shouldBeTrue("event.alpha == null");
shouldBeTrue("event.beta == null");
shouldBeTrue("event.gamma == null");

evalAndLog("event.initDeviceOrientationEvent('', false, false, '', '', '')");
shouldBeTrue("event.alpha == 0");
shouldBeTrue("event.beta == 0");
shouldBeTrue("event.gamma == 0");

evalAndLog("event.initDeviceOrientationEvent('', false, false, null, null, null)");
shouldBeTrue("event.alpha == null");
shouldBeTrue("event.beta == null");
shouldBeTrue("event.gamma == null");

window.successfullyParsed = true;