This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch base-browser-102.5.0esr-12.0-1 in repository tor-browser.
commit b6943187696370ebdde0ca6af8bddbca047fcd6f Author: Brian Grinstead bgrinstead@mozilla.com AuthorDate: Thu Sep 8 16:52:15 2022 +0000
Bug 1625632 - Test for button element forwarding accesskey to dialog buttons. r=dao, a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D156623 --- toolkit/content/tests/chrome/chrome.ini | 2 ++ toolkit/content/tests/chrome/dialog_button.xhtml | 9 ++++++ .../content/tests/chrome/test_dialog_button.xhtml | 36 ++++++++++++++++++++++ 3 files changed, 47 insertions(+)
diff --git a/toolkit/content/tests/chrome/chrome.ini b/toolkit/content/tests/chrome/chrome.ini index 089dfaf2ec99..093a89d75cc4 100644 --- a/toolkit/content/tests/chrome/chrome.ini +++ b/toolkit/content/tests/chrome/chrome.ini @@ -12,6 +12,7 @@ support-files = bug409624_window.xhtml bug429723_window.xhtml bug624329_window.xhtml + dialog_button.xhtml dialog_dialogfocus.xhtml dialog_dialogfocus2.xhtml file_empty.xhtml @@ -108,6 +109,7 @@ skip-if = toolkit == "cocoa" [test_custom_element_delay_connection.xhtml] [test_custom_element_parts.html] [test_deck.xhtml] +[test_dialog_button.xhtml] [test_dialogfocus.xhtml] [test_edit_contextmenu.html] [test_editor_for_input_with_autocomplete.html] diff --git a/toolkit/content/tests/chrome/dialog_button.xhtml b/toolkit/content/tests/chrome/dialog_button.xhtml new file mode 100644 index 000000000000..64bf916fffc5 --- /dev/null +++ b/toolkit/content/tests/chrome/dialog_button.xhtml @@ -0,0 +1,9 @@ +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<window id='root' xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <dialog id="dialog-focus" + buttons="accept" + buttonlabelaccept="accept" + buttonaccesskeyaccept="a"> + <button id="button"></button> + </dialog> +</window> diff --git a/toolkit/content/tests/chrome/test_dialog_button.xhtml b/toolkit/content/tests/chrome/test_dialog_button.xhtml new file mode 100644 index 000000000000..8c973839c11a --- /dev/null +++ b/toolkit/content/tests/chrome/test_dialog_button.xhtml @@ -0,0 +1,36 @@ +<!DOCTYPE HTML> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta charset="utf-8" /> + <title><!-- Test with dialog & buttons --></title> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> + <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> + <script><![CDATA[ + add_task(async function test_dialog_button_accesskey() { + var win = window.browsingContext.topChromeWindow.openDialog( + "dialog_button.xhtml", + "_new", + "chrome,dialog" + ); + await new Promise((r) => win.addEventListener("load", r, { once: true })); + + let dialogClosed = new Promise((r) => { + win.document.addEventListener("dialogclosing", r, { once: true }); + }); + // https://bugzilla.mozilla.org/show_bug.cgi?id=1625632 + // When pressing an accesskey for a built in dialog button while a regular button is focused, + // it should forward to the dialog. + win.document.querySelector("#button").focus(); + synthesizeKey("a", {}, win); + await dialogClosed; + ok(true, "Accesskey on focused button"); + }); + ]]></script> +</head> +<body> +<p id="display"></p> +<div id="content" style="display: none"></div> +<pre id="test"></pre> +</body> +</html>