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