Bug 1539816 - Always filter the autocomplete popup items if the popup was opened. .

Currently, if the autocomplete preference is set to false, and the user
displays the autocomplete popup with Ctrl + Space, typing other letters
won't filter the popup, which feels very weird.
This patch fixes this behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D28597

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dhruvi Butti 2019-06-06 15:05:31 +00:00
Родитель 04d84e7e43
Коммит 4d7125f280
2 изменённых файлов: 11 добавлений и 3 удалений

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

@ -841,7 +841,7 @@ class JSTerm extends Component {
const value = this._getValue();
if (this.lastInputValue !== value) {
this.resizeInput();
if (this.props.autocomplete) {
if (this.props.autocomplete || this.autocompletePopup.isOpen) {
this.autocompleteUpdate();
}
this.lastInputValue = value;

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

@ -20,9 +20,9 @@ async function performTests_false() {
const { autocompletePopup: popup } = hud.jsterm;
info(`Enter ":"`);
info(`Enter "w"`);
jsterm.focus();
EventUtils.sendString(":");
EventUtils.sendString("w");
// delay of 2 seconds.
await wait(2000);
ok(!popup.isOpen, "popup is not open");
@ -35,4 +35,12 @@ async function performTests_false() {
await onPopUpOpen;
ok(popup.isOpen, "popup opens on Ctrl+Space");
const onUpdated = jsterm.once("autocomplete-updated");
ok(popup.getItems().length > 0, "'w' gave a list of suggestions");
EventUtils.synthesizeKey("in");
await onUpdated;
ok(popup.getItems().length == 2, "'win' gave a list of suggestions");
}