fune/browser/base/content/test/general/browser_autocomplete_cursor.js
Dave Townsend 2a37c3fd31 Bug 1174471: Override autocomplete's default handling of left, right and home key presses. r=markh
--HG--
extra : commitid : 1vRg6fFBcwM
extra : rebase_source : 88a409c3cc7097ba51c0c09e9b4be150bad07e54
extra : amend_source : 3c5a10f0af3e464d1776b9283cbb08522f66a567
2015-06-18 11:02:11 -07:00

25 lines
949 B
JavaScript

add_task(function*() {
// This test is only relevant if UnifiedComplete is enabled.
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
registerCleanupFunction(() => {
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
});
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
yield promiseTabLoaded(tab);
yield promiseAutocompleteResultPopup("www.mozilla.org");
gURLBar.selectTextRange(4, 4);
is(gURLBar.popup.state, "open", "Popup should be open");
is(gURLBar.popup.richlistbox.selectedIndex, 0, "Should have selected something");
EventUtils.synthesizeKey("VK_RIGHT", {});
yield promisePopupHidden(gURLBar.popup);
is(gURLBar.selectionStart, 5, "Should have moved the cursor");
is(gURLBar.selectionEnd, 5, "And not selected anything");
gBrowser.removeTab(tab);
});