Bug 962652 - Autocomplete popup's isOpen getter is too strict, r=msucan

This commit is contained in:
Girish Sharma 2014-01-28 20:42:02 +05:30
Родитель 60d58aad6a
Коммит 68dc41254c
9 изменённых файлов: 10 добавлений и 21 удалений

Просмотреть файл

@ -89,8 +89,7 @@ function test()
inspector.searchSuggestions._lastQuery.then(() => {
let [key, suggestions] = keyStates[state];
let actualSuggestions = popup.getItems();
is(popup._panel.state == "open" || popup._panel.state == "showing"
? actualSuggestions.length: 0, suggestions.length,
is(popup.isOpen ? actualSuggestions.length: 0, suggestions.length,
"There are expected number of suggestions at " + state + "th step.");
actualSuggestions = actualSuggestions.reverse();
for (let i = 0; i < suggestions.length; i++) {

Просмотреть файл

@ -90,8 +90,7 @@ function test()
inspector.searchSuggestions._lastQuery.then(() => {
let [key, suggestions] = keyStates[state];
let actualSuggestions = popup.getItems();
is(popup._panel.state == "open" || popup._panel.state == "showing"
? actualSuggestions.length: 0, suggestions.length,
is(popup.isOpen ? actualSuggestions.length: 0, suggestions.length,
"There are expected number of suggestions at " + state + "th step.");
actualSuggestions = actualSuggestions.reverse();
for (let i = 0; i < suggestions.length; i++) {

Просмотреть файл

@ -130,9 +130,7 @@ function test() {
is(editor.input.selectionEnd, selEnd,
"Selection is ending at the right location for state " + state);
if (popupOpen) {
ok(editor.popup._panel.state == "open" ||
editor.popup._panel.state == "showing",
"Popup is open for state " + state);
ok(editor.popup.isOpen, "Popup is open for state " + state);
}
else {
ok(editor.popup._panel.state != "open" &&

Просмотреть файл

@ -159,7 +159,7 @@ AutocompletePopup.prototype = {
* Check if the autocomplete popup is open.
*/
get isOpen() {
return this._panel.state == "open";
return this._panel.state == "open" || this._panel.state == "showing";
},
/**

Просмотреть файл

@ -30,7 +30,7 @@ function setupAutoCompletion(ctx, walker) {
let keyMap = {
"Tab": cm => {
if (popup && (popup.isOpen || popup._panel.state == "showing")) {
if (popup && popup.isOpen) {
cycleSuggestions(ed);
return;
}
@ -38,7 +38,7 @@ function setupAutoCompletion(ctx, walker) {
return win.CodeMirror.Pass;
},
"Shift-Tab": cm => {
if (popup && (popup.isOpen || popup._panel.state == "showing")) {
if (popup && popup.isOpen) {
cycleSuggestions(ed, true);
return;
}

Просмотреть файл

@ -125,8 +125,7 @@ function checkState() {
info("After keypress for index " + index);
let [key, total, current, inserted] = TEST_CASES[index];
if (total != -1) {
ok(gPopup._panel.state == "open" || gPopup._panel.state == "showing",
"Popup is open for index " + index);
ok(gPopup.isOpen, "Popup is open for index " + index);
is(total, gPopup.itemCount,
"Correct total suggestions for index " + index);
is(current, gPopup.selectedIndex,

Просмотреть файл

@ -105,9 +105,7 @@ function checkState(event) {
state);
}
else {
ok(editor.popup._panel.state == "open" ||
editor.popup._panel.state == "showing",
"Popup is open for state " + state);
ok(editor.popup.isOpen, "Popup is open for state " + state);
is(editor.popup.getItems().length, total,
"Number of suggestions match for state " + state);
is(editor.popup.selectedIndex, index,

Просмотреть файл

@ -117,9 +117,7 @@ function checkState(event) {
state);
}
else {
ok(editor.popup._panel.state == "open" ||
editor.popup._panel.state == "showing",
"Popup is open for state " + state);
ok(editor.popup.isOpen, "Popup is open for state " + state);
is(editor.popup.getItems().length, total,
"Number of suggestions match for state " + state);
is(editor.popup.selectedIndex, index,

Просмотреть файл

@ -114,9 +114,7 @@ function checkState(event) {
state);
}
else {
ok(editor.popup._panel.state == "open" ||
editor.popup._panel.state == "showing",
"Popup is open for state " + state);
ok(editor.popup.isOpen, "Popup is open for state " + state);
is(editor.popup.getItems().length, total,
"Number of suggestions match for state " + state);
is(editor.popup.selectedIndex, index,