forked from mirrors/gecko-dev
		
	 142488d3c4
			
		
	
	
		142488d3c4
		
	
	
	
	
		
			
			Now we won't dispatch click event at all when ctrl key is pressed on Mac, so we don't need those Mac-specific checks. This patch reverts part of https://hg.mozilla.org/mozilla-central/rev/d8726d18021e and revise the tests accordingly. Differential Revision: https://phabricator.services.mozilla.com/D110608
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <?xml version="1.0"?>
 | |
| <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 | |
| <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
 | |
| <!--
 | |
|   XUL Widget Test for the toolbarbutton element
 | |
|   -->
 | |
| <window title="Titlebar" width="200" height="200"
 | |
|         onload="setTimeout(test_resizer_ctrl_click, 0);"
 | |
|         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 | |
| <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 | |
| <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
 | |
| 
 | |
| <toolbarbutton id="toolbarbutton" width="16" height="16"/>
 | |
| 
 | |
| <!-- test code goes here -->
 | |
| <script type="application/javascript"><![CDATA[
 | |
| 
 | |
| const { AppConstants } = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
 | |
| 
 | |
| SimpleTest.waitForExplicitFinish();
 | |
| 
 | |
| function test_resizer_ctrl_click()
 | |
| {
 | |
|   let toolbarbutton = document.getElementById("toolbarbutton");
 | |
|   let isCommandFired = false;
 | |
| 
 | |
|   toolbarbutton.addEventListener("click", function(aEvent) {
 | |
|     // Delay check for command event, because it is fired after click event.
 | |
|     setTimeout(() => {
 | |
|       ok(isCommandFired, "Check if command event is fired");
 | |
|       SimpleTest.finish();
 | |
|     }, 0);
 | |
|   });
 | |
|   toolbarbutton.addEventListener("command", function(aEvent) {
 | |
|     isCommandFired = true;
 | |
|     ok(aEvent.ctrlKey, "Check ctrlKey for command event");
 | |
|     ok(!aEvent.shiftKey, "Check shiftKey for command event");
 | |
|     ok(!aEvent.altKey, "Check altKey for command event");
 | |
|     ok(!aEvent.metaKey, "Check metaKey for command event");
 | |
|     is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
 | |
|        "Check inputSource for command event");
 | |
|   });
 | |
|   synthesizeMouseAtCenter(toolbarbutton, { ctrlKey: true });
 | |
| }
 | |
| 
 | |
| ]]>
 | |
| </script>
 | |
| 
 | |
| </window>
 |