summaryrefslogtreecommitdiffstats
path: root/browser/components/urlbar/tests/browser/browser_delete.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/components/urlbar/tests/browser/browser_delete.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/urlbar/tests/browser/browser_delete.js')
-rw-r--r--browser/components/urlbar/tests/browser/browser_delete.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/browser/components/urlbar/tests/browser/browser_delete.js b/browser/components/urlbar/tests/browser/browser_delete.js
new file mode 100644
index 0000000000..48fce657ad
--- /dev/null
+++ b/browser/components/urlbar/tests/browser/browser_delete.js
@@ -0,0 +1,51 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Test deleting the start of urls works correctly.
+ */
+
+add_task(async function() {
+ let bm = await PlacesUtils.bookmarks.insert({
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ url: "http://bug1105244.example.com/",
+ title: "test",
+ });
+
+ registerCleanupFunction(async function() {
+ await PlacesUtils.bookmarks.remove(bm);
+ });
+
+ await BrowserTestUtils.withNewTab("about:blank", testDelete);
+});
+
+function sendHome() {
+ // unclear why VK_HOME doesn't work on Mac, but it doesn't...
+ if (AppConstants.platform == "macosx") {
+ EventUtils.synthesizeKey("KEY_ArrowLeft", { metaKey: true });
+ } else {
+ EventUtils.synthesizeKey("KEY_Home");
+ }
+}
+
+function sendDelete() {
+ EventUtils.synthesizeKey("KEY_Delete");
+}
+
+async function testDelete() {
+ await UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "bug1105244",
+ });
+
+ // move to the start.
+ sendHome();
+
+ // delete the first few chars - each delete should operate on the input field.
+ await UrlbarTestUtils.promisePopupOpen(window, sendDelete);
+ Assert.equal(gURLBar.inputField.value, "ug1105244.example.com/");
+ sendDelete();
+ Assert.equal(gURLBar.inputField.value, "g1105244.example.com/");
+}