Bug 1333345 - Part 2: Add test to demonstrate buggy keyboard shortcut behavior in address bar. r?mak draft
authorChris Peterson <cpeterson@mozilla.com>
Sat, 11 Feb 2017 21:01:21 -0800
changeset 490297 de586d7787feee2fa430fffe23f733ca43a2ec29
parent 490296 5540bd2025f72e85dc3d48ec7e7dbfcf80abe414
child 490298 af4b624b55fd39b85830e962f69a80c78c3aa5d9
push id47057
push usercpeterson@mozilla.com
push dateTue, 28 Feb 2017 02:48:55 +0000
reviewersmak
bugs1333345
milestone54.0a1
Bug 1333345 - Part 2: Add test to demonstrate buggy keyboard shortcut behavior in address bar. r?mak Shift+Enter should add 'www.' and '.net' to search string, but uses the autocomplete suggestion 'example.com' instead. This test case documents the bug, which will be fixed in a subsequent commit. MozReview-Commit-ID: 6jMrezneHk1
browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
--- a/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
@@ -1,10 +1,12 @@
 // The order of these tests matters!
 
+"use strict";
+
 add_task(function* setup() {
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);
   let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
                                                 url: "http://example.com/?q=%s",
                                                 title: "test" });
   registerCleanupFunction(function* () {
     yield PlacesUtils.bookmarks.remove(bm);
     yield BrowserTestUtils.removeTab(tab);
@@ -37,16 +39,29 @@ add_task(function* test_sametext() {
   gURLBar.dispatchEvent(event);
   EventUtils.synthesizeKey("VK_RETURN", {});
 
   info("wait for the page to load");
   yield BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser,
                                        false, "http://example.com/");
 });
 
+add_task(function* test_expand_search_string() {
+  yield promiseAutocompleteResultPopup("example");
+  is(gURLBar.textValue, "example.com/", "Autocomplete should suggest 'example.com/' for 'example'");
+
+  gURLBar.focus();
+  EventUtils.synthesizeKey("VK_RETURN", {shiftKey: true});
+
+  info("wait for the page to load");
+  yield BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser);
+
+  is(gURLBar.textValue, "example.com", "Shift+Enter should add 'www.' and '.net' to search string, but uses the autocomplete suggestion 'example.com' instead! This is bug 1333345.");
+});
+
 add_task(function* test_after_empty_search() {
   yield promiseAutocompleteResultPopup("");
   gURLBar.focus();
   gURLBar.value = "e";
   EventUtils.synthesizeKey("x", {});
   EventUtils.synthesizeKey("VK_RETURN", {});
 
   info("wait for the page to load");