From 9b72cbfa113c48f2c396055f8ff04970d2ae3aa1 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Fri, 19 May 2017 11:30:29 +0300 Subject: Fix resetting of last filter in VComboBox (#9381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the reset method resets the lastFilter as well and then the logic thinks items don’t need to be refreshed when popup is reopened. Fixes #9027 Fixes #7790 --- .../components/combobox/ComboBoxSelectingTest.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'uitest') 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; @@ -27,6 +28,31 @@ public class ComboBoxSelectingTest extends MultiBrowserTest { comboBoxElement = $(ComboBoxElement.class).first(); } + @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"); -- cgit v1.2.3