зеркало из https://github.com/mozilla/gecko-dev.git
Bug 962652 - Autocomplete popup's isOpen getter is too strict, r=msucan
This commit is contained in:
Родитель
60d58aad6a
Коммит
68dc41254c
|
@ -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,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче