submitted/mosquito/DeviceOrientation/t003.html
author Dominique Hazael-Massieux <dom@w3.org>
Wed, 30 May 2012 14:40:41 +0200
changeset 0 80de249b382e
child 1 e0aec940fb46
permissions -rw-r--r--
import from http://html5.mosquito-fp7.eu/pages/device_orientation_api.html
<!DOCTYPE html>
<html>

	<head>
		<title>User agents must also provide an event handler IDL attribute [HTML5] named ondeviceorientation on the window object:</title>
		<meta name=viewport content="width=device-width, maximum-scale=1.0, user-scalable=no" />
		<script src="http://w3c-test.org/resources/testharness.js"></script>
		<script src="http://w3c-test.org/resources/testharnessreport.js"></script>
	</head>

  <body>

  
  		<h1>User agents must also provide an event handler IDL attribute [HTML5] named ondeviceorientation on the window object:</h1>
    <div id="log">
    </div>
	
	<script type="text/javascript">
		t1 = async_test("Provide an event handler IDL attribute [HTML5] named ondeviceorientation");
		t2 = async_test("The type of this event handler must be 'DeviceOrientationEvent'");
		ename = null;
		etype = null;
		window.ondeviceorientation = function(e){
			ename = e.type;
			etype = ""+e.constructor
		};
		
		setTimeout("testing()", 200);
		
		function testing(){
			t1.step(function() {assert_equals(ename, "deviceorientation")});
			t2.step(function() {assert_true(etype.lastIndexOf("DeviceOrientationEvent") != -1)});
			t1.done();
			t2.done();
		}
	</script>
	
  </body>
  
</html>