diff options
author | Adam Wagner <wbadam@users.noreply.github.com> | 2017-10-30 13:31:27 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-10-30 13:31:27 +0200 |
commit | ffe1e0c022c2098a0b719bffe0c9a707003bde05 (patch) | |
tree | 76571c5d276f52c6a40b346a4416ad346e00c58e /uitest | |
parent | e65efdfb50bc10bedf506d475f582276f6be0e2f (diff) | |
download | vaadin-framework-ffe1e0c022c2098a0b719bffe0c9a707003bde05.tar.gz vaadin-framework-ffe1e0c022c2098a0b719bffe0c9a707003bde05.zip |
Fix combo box suggestion popup height (#10256)
Fixes #10214
Diffstat (limited to 'uitest')
4 files changed, 80 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxHeight.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxHeight.java new file mode 100644 index 0000000000..ba6956dc22 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxHeight.java @@ -0,0 +1,25 @@ +package com.vaadin.tests.components.combobox; + +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class ComboBoxHeight extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + ComboBox<String> comboBox = new ComboBox<>(); + comboBox.setPageLength(0); + comboBox.setItems( + IntStream.range(0, 100) + .mapToObj(i -> "Item number " + String.valueOf(i)) + .collect(Collectors.toList())); + + addComponent(comboBox); + } +} diff --git a/uitest/src/main/themes/VAADIN/themes/tests-valo-combobox-height/_variables.scss b/uitest/src/main/themes/VAADIN/themes/tests-valo-combobox-height/_variables.scss new file mode 100644 index 0000000000..d4c7111398 --- /dev/null +++ b/uitest/src/main/themes/VAADIN/themes/tests-valo-combobox-height/_variables.scss @@ -0,0 +1,4 @@ +$v-selection-overlay-padding-vertical: 10px; +$v-selection-overlay-padding-horizontal: 10px; + +@import "../valo/valo"; diff --git a/uitest/src/main/themes/VAADIN/themes/tests-valo-combobox-height/styles.scss b/uitest/src/main/themes/VAADIN/themes/tests-valo-combobox-height/styles.scss new file mode 100644 index 0000000000..6b3926dcf6 --- /dev/null +++ b/uitest/src/main/themes/VAADIN/themes/tests-valo-combobox-height/styles.scss @@ -0,0 +1,13 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-combobox-height { + @include valotest; + + .v-filterselect-suggestpopup { + margin-top: 10px !important; + margin-bottom: 10px; + padding-top: 5px; + padding-bottom: 5px; + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxHeightTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxHeightTest.java new file mode 100644 index 0000000000..512238b759 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxHeightTest.java @@ -0,0 +1,38 @@ +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.SingleBrowserTest; + +public class ComboBoxHeightTest extends SingleBrowserTest { + + @Test + public void testPopupHeight() { + openTestURL(); + assertPopupHeight(); + } + + @Test + public void testPopupHeightCustomTheme() { + openTestURL("theme=tests-valo-combobox-height"); + assertPopupHeight(); + } + + private void assertPopupHeight() { + ComboBoxElement comboBox = $(ComboBoxElement.class).first(); + + comboBox.openPopup(); + WebElement suggestionPopup = comboBox.getSuggestionPopup(); + + int suggestionPopupBottom = + suggestionPopup.getLocation().getY() + suggestionPopup.getSize() + .getHeight(); + + assertGreaterOrEqual( + "Combo box suggestion popup should not exceed the browser's viewport", + driver.manage().window().getSize().getHeight(), + suggestionPopupBottom); + } +} |