Bug 463635 - All Tabs search doesn't always update on Enter. r=gavin

This commit is contained in:
Dão Gottwald 2008-11-12 08:07:49 +01:00
parent 0284ad8e37
commit 7067b0d947
2 changed files with 18 additions and 3 deletions

View File

@ -617,8 +617,12 @@ var ctrlTab = {
case "keydown":
case "keyup":
if (event.target == this.searchField) {
if (event.keyCode == event.DOM_VK_RETURN)
this.panel.focus();
if (event.keyCode == event.DOM_VK_RETURN) {
// If there's a pending search, kick it off now.
if (this.searchField._timer)
this.search();
this.selectThumbnail();
}
} else {
// Manually consume the events, as the panel is open but doesn't
// necessarily have focus.

View File

@ -91,7 +91,18 @@ function test() {
ok(isOpen(),
"panel is sticky after focusing the search field and releasing the Ctrl key");
ctrlTab.searchField.value = "foo";
EventUtils.synthesizeKey("f", {});
EventUtils.synthesizeKey("o", {});
EventUtils.synthesizeKey("o", {});
is(ctrlTab.searchField.value, "foo",
"text entered into search field");
EventUtils.synthesizeKey("VK_RETURN", {});
ok(isOpen(),
"Enter key kicks pending search off; the panel stays open as there's no match");
is(ctrlTab.searchField.value, "foo",
"search field value persists after Enter pressed");
EventUtils.synthesizeKey("VK_ESCAPE", {});
is(ctrlTab.searchField.value, "",
"ESC key clears the search field");