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

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

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

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

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

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

@ -159,7 +159,7 @@ AutocompletePopup.prototype = {
* Check if the autocomplete popup is open. * Check if the autocomplete popup is open.
*/ */
get isOpen() { 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 = { let keyMap = {
"Tab": cm => { "Tab": cm => {
if (popup && (popup.isOpen || popup._panel.state == "showing")) { if (popup && popup.isOpen) {
cycleSuggestions(ed); cycleSuggestions(ed);
return; return;
} }
@ -38,7 +38,7 @@ function setupAutoCompletion(ctx, walker) {
return win.CodeMirror.Pass; return win.CodeMirror.Pass;
}, },
"Shift-Tab": cm => { "Shift-Tab": cm => {
if (popup && (popup.isOpen || popup._panel.state == "showing")) { if (popup && popup.isOpen) {
cycleSuggestions(ed, true); cycleSuggestions(ed, true);
return; return;
} }

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

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

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

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

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

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

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

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