no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / xul / test / test_toolbarbutton_ctrl_click.xhtml
blobb4f1bac5bf2f68817d322e6e6ef7f57d96ebbbcd
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 XUL Widget Test for the toolbarbutton element
6 -->
7 <window title="Titlebar" width="200" height="200"
8 onload="setTimeout(test_resizer_ctrl_click, 0);"
9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
13 <toolbarbutton id="toolbarbutton" width="16" height="16"/>
15 <!-- test code goes here -->
16 <script type="application/javascript"><![CDATA[
18 SimpleTest.waitForExplicitFinish();
20 function test_resizer_ctrl_click()
22 let toolbarbutton = document.getElementById("toolbarbutton");
23 let isCommandFired = false;
25 toolbarbutton.addEventListener("click", function(aEvent) {
26 // Delay check for command event, because it is fired after click event.
27 setTimeout(() => {
28 ok(isCommandFired, "Check if command event is fired");
29 SimpleTest.finish();
30 }, 0);
31 });
32 toolbarbutton.addEventListener("command", function(aEvent) {
33 isCommandFired = true;
34 ok(aEvent.ctrlKey, "Check ctrlKey for command event");
35 ok(!aEvent.shiftKey, "Check shiftKey for command event");
36 ok(!aEvent.altKey, "Check altKey for command event");
37 ok(!aEvent.metaKey, "Check metaKey for command event");
38 is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
39 "Check inputSource for command event");
40 });
41 synthesizeMouseAtCenter(toolbarbutton, { ctrlKey: true });
44 ]]>
45 </script>
47 </window>