diff options
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VComboBox.java | 1 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java index 668e88b126..2a76907170 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java @@ -2319,7 +2319,6 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, .findAny().orElse(null); } - lastFilter = ""; suggestionPopup.hide(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java index cf3450a14f..616c9a8e82 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java @@ -3,6 +3,7 @@ package com.vaadin.tests.components.combobox; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; @@ -28,6 +29,31 @@ public class ComboBoxSelectingTest extends MultiBrowserTest { } @Test + public void ensureOldFilterIsCleared() { + comboBoxElement.openPopup(); + int initialVisibleOptions = countVisibleOptions(); + clearInputAndType("b11"); + int visibleOptionsAfterFiltering = countVisibleOptions(); + Assert.assertEquals(1, visibleOptionsAfterFiltering); + clickOnLabel(); + sleep(1000); + // no selection was made, clicking on arrow should show all options + // again + comboBoxElement.openPopup(); + + int visibleOptions = countVisibleOptions(); + Assert.assertEquals(initialVisibleOptions, visibleOptions); + } + + private int countVisibleOptions() { + return comboBoxElement.getPopupSuggestions().size(); + } + + private void clickOnLabel() { + getDriver().findElement(By.cssSelector(".v-label")).click(); + } + + @Test public void firstSuggestionIsSelectedWithEnter() { typeInputAndHitEnter("a"); |