From f1dc01ec76840d995d562ba04d6ef6553c19b749 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Wed, 23 Oct 2019 14:24:19 +0300 Subject: When ComboBox popup opens to the left accommodate margin/border/padding. (#11755) Fixes #11718 --- .../combobox/ComboBoxAtRightEdgeTest.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtRightEdgeTest.java (limited to 'uitest/src/test/java/com/vaadin/tests') diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtRightEdgeTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtRightEdgeTest.java new file mode 100644 index 0000000000..e65d4ed12b --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAtRightEdgeTest.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.components.combobox; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ComboBoxAtRightEdgeTest extends MultiBrowserTest { + + @Test + public void ensurePopupInView() { + openTestURL(); + + ComboBoxElement cb = $(ComboBoxElement.class).first(); + cb.openPopup(); + WebElement popup = cb.getSuggestionPopup(); + + int cbRight = cb.getLocation().getX() + cb.getSize().getWidth(); + int popupRight = popup.getLocation().getX() + + popup.getSize().getWidth(); + assertGreaterOrEqual(String.format( + "Popup should not reach further right than the ComboBox at the " + + "right edge of the viewport. ComboBox: %s, Popup: %s", + cbRight, popupRight), cbRight, popupRight); + } +} -- cgit v1.2.3