1 description('Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined.'); 2 3 var event; 4 5 evalAndLog("event = document.createEvent('DeviceOrientationEvent')"); 6 shouldBeTrue("event.alpha == null"); 7 shouldBeTrue("event.beta == null"); 8 shouldBeTrue("event.gamma == null"); 9 10 evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2)"); 11 shouldBeTrue("event.alpha == 0"); 12 shouldBeTrue("event.beta == 1"); 13 shouldBeTrue("event.gamma == 2"); 14 15 evalAndLog("event.initDeviceOrientationEvent()"); 16 shouldBeTrue("event.alpha == null"); 17 shouldBeTrue("event.beta == null"); 18 shouldBeTrue("event.gamma == null"); 19 20 evalAndLog("event.initDeviceOrientationEvent('', false, false, [], [], [])"); 21 shouldBeTrue("event.alpha == 0"); 22 shouldBeTrue("event.beta == 0"); 23 shouldBeTrue("event.gamma == 0"); 24 25 evalAndLog("event.initDeviceOrientationEvent('', false, false, undefined, undefined, undefined)"); 26 shouldBeTrue("event.alpha == null"); 27 shouldBeTrue("event.beta == null"); 28 shouldBeTrue("event.gamma == null"); 29 30 evalAndLog("event.initDeviceOrientationEvent('', false, false, '', '', '')"); 31 shouldBeTrue("event.alpha == 0"); 32 shouldBeTrue("event.beta == 0"); 33 shouldBeTrue("event.gamma == 0"); 34 35 evalAndLog("event.initDeviceOrientationEvent('', false, false, null, null, null)"); 36 shouldBeTrue("event.alpha == null"); 37 shouldBeTrue("event.beta == null"); 38 shouldBeTrue("event.gamma == null"); 39 40 window.successfullyParsed = true; 41