test_bug547996-3.xhtml (1603B)
1 <?xml version="1.0"?> 2 <html xmlns="http://www.w3.org/1999/xhtml" 3 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=547996 6 --> 7 <head> 8 <title>Test for Bug 547996</title> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 10 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 12 </head> 13 <body> 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=547996">Mozilla Bug 547996</a> 15 <p id="display"></p> 16 <div id="content" style="display: none"></div> 17 <pre id="test"> 18 <script>//<![CDATA[ 19 20 /** Test for Bug 547996 */ 21 /* mouseEvent.inputSource attribute */ 22 23 var expectedInputSource = null; 24 25 function check(event) { 26 is(event.inputSource, expectedInputSource, ".inputSource"); 27 } 28 29 function doTest() { 30 setup(); 31 32 expectedInputSource = MouseEvent.MOZ_SOURCE_MOUSE; 33 testMouse(); 34 35 expectedInputSource = MouseEvent.MOZ_SOURCE_UNKNOWN; 36 testScriptedClicks(); 37 38 cleanup(); 39 SimpleTest.finish(); 40 } 41 42 function testMouse() { 43 synthesizeMouse($("xulButtonTarget"), 0, 0, {}); 44 } 45 46 function testScriptedClicks() { 47 $("xulButtonTarget").click(); 48 } 49 50 function setup() { 51 $("xulButtonTarget").addEventListener("click", check); 52 } 53 54 function cleanup() { 55 $("xulButtonTarget").removeEventListener("click", check); 56 } 57 58 SimpleTest.waitForExplicitFinish(); 59 SimpleTest.waitForFocus(doTest, window); 60 61 //]]> 62 </script> 63 </pre> 64 <xul:button id="xulButtonTarget" accesskey="t">XUL Button</xul:button> 65 </body> 66 </html>