aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2020-06-26 15:50:51 +0300
committerGitHub <noreply@github.com>2020-06-26 15:50:51 +0300
commit797b49372f3198495cb4e331cab85e040afd352e (patch)
tree148b5f4dddaec16d8c5ca77e6370b6711dc25bc6 /uitest
parentd824efe59a71e2eb3e554873a32d92ca5d34cc5e (diff)
downloadvaadin-framework-797b49372f3198495cb4e331cab85e040afd352e.tar.gz
vaadin-framework-797b49372f3198495cb4e331cab85e040afd352e.zip
Update ComboBox popup position comparison to use correct top value. (#12041)
Fixes #12029
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayout.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayoutTest.java35
2 files changed, 36 insertions, 1 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayout.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayout.java
index 5c619bafc4..6a15de3876 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayout.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayout.java
@@ -13,7 +13,7 @@ public class ComboBoxAtBottomEdgeWithinHorizontalLayout extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
ComboBox<Integer> comboBox = new ComboBox<>();
- comboBox.setItems(Arrays.asList(100, 200, 300, 400, 500));
+ comboBox.setItems(Arrays.asList(102, 205, 302, 402, 500));
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.addComponent(comboBox);
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayoutTest.java
index f169e56ab5..f3da49fe75 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayoutTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtBottomEdgeWithinHorizontalLayoutTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.combobox;
import org.junit.Test;
import org.openqa.selenium.WebElement;
+import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.ComboBoxElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -26,4 +27,38 @@ public class ComboBoxAtBottomEdgeWithinHorizontalLayoutTest
cbBottom, popupBottom), cbBottom, popupBottom);
}
+ @Test
+ public void ensurePopupPositionUpdatesWhenFiltered() {
+ openTestURL();
+
+ ComboBoxElement cb = $(ComboBoxElement.class).first();
+ cb.openPopup();
+ WebElement popup = cb.getSuggestionPopup();
+
+ int initialTop = popup.getLocation().getY();
+
+ // filter a bit
+ cb.findElement(By.vaadin("#textbox")).sendKeys("2");
+ int updatedTop = popup.getLocation().getY();
+ assertLessThan(String.format(
+ "Popup should be repositioned when "
+ + "filtered. Initial: %s, Updated: %s",
+ initialTop, updatedTop), initialTop, updatedTop);
+ int cbBottom = cb.getLocation().getY() + cb.getSize().getHeight();
+ assertGreaterOrEqual(String.format(
+ "Popup should still open above the ComboBox when "
+ + "filtered a bit. ComboBox: %s, Popup: %s",
+ cbBottom, updatedTop), cbBottom, updatedTop);
+
+ // filter more
+ cb.clear();
+ cb.findElement(By.vaadin("#textbox")).sendKeys("1");
+ popup = cb.getSuggestionPopup();
+ updatedTop = popup.getLocation().getY();
+ assertLessThanOrEqual(String.format(
+ "Popup should open below the ComboBox when "
+ + "filtered down to one result. ComboBox: %s, Popup: %s",
+ cbBottom, updatedTop), cbBottom, updatedTop);
+ }
+
}