summaryrefslogtreecommitdiffstats
path: root/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /layout/xul/test/test_toolbarbutton_ctrl_click.xhtml
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/xul/test/test_toolbarbutton_ctrl_click.xhtml')
-rw-r--r--layout/xul/test/test_toolbarbutton_ctrl_click.xhtml51
1 files changed, 51 insertions, 0 deletions
diff --git a/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml b/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml
new file mode 100644
index 0000000000..6ad5f18ae7
--- /dev/null
+++ b/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml
@@ -0,0 +1,51 @@
+<?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.ChromeUtils.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>