Bug 1114011 - for autocomplete with for minresultsforpopup > 1: entering match doesn't work properly. r=mak

This commit is contained in:
Magnus Melin 2015-01-10 13:48:24 +02:00
parent b6760aec97
commit f25d7e95ef
2 changed files with 20 additions and 1 deletions

View File

@ -484,7 +484,13 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
// The user hit a text-navigation key.
bool isOpen = false;
input->GetPopupOpen(&isOpen);
if (isOpen) {
// If minresultsforpopup > 1 and there's less matches than the minimum
// required, the popup is not open, but the search suggestion is showing
// inline, so we should proceed as if we had the popup.
uint32_t minResultsForPopup;
input->GetMinResultsForPopup(&minResultsForPopup);
if (isOpen || (mRowCount > 0 && mRowCount < minResultsForPopup)) {
int32_t selectedIndex;
popup->GetSelectedIndex(&selectedIndex);
bool shouldComplete;

View File

@ -159,6 +159,14 @@ const tests = [
result: "Result",
start: 6, end: 6
},
{
desc: "RIGHT key w/ minResultsForPopup=2",
key: "VK_RIGHT",
removeSelection: false,
minResultsForPopup: 2,
result: "Result",
start: 6, end: 6
},
];
function nextTest() {
@ -185,6 +193,11 @@ function nextTest() {
function runCurrentTest() {
var autocomplete = $("autocomplete");
if ("minResultsForPopup" in currentTest)
autocomplete.setAttribute("minresultsforpopup", currentTest.minResultsForPopup)
else
autocomplete.removeAttribute("minresultsforpopup");
autocomplete.focus();
if (!currentTest.completeFromMiddle) {