2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css" type=
"text/css"?>
5 XUL Widget Test for the toolbarbutton element
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.
28 ok(isCommandFired,
"Check if command event is fired");
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");
41 synthesizeMouseAtCenter(toolbarbutton, { ctrlKey: true });