diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-06-05 15:06:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-05 15:06:25 +0300 |
commit | 3b3c647e5b732a7e9e6109193a11e665270ffe2f (patch) | |
tree | 3e1b435ff965ba45ccbb5a3408c8e8eb4ecd6e2c /uitest | |
parent | bdb81a11c6deb76638a3e1f82f123d94744295a7 (diff) | |
download | vaadin-framework-3b3c647e5b732a7e9e6109193a11e665270ffe2f.tar.gz vaadin-framework-3b3c647e5b732a7e9e6109193a11e665270ffe2f.zip |
Show empty selection caption in ComboBox (#9468)
Fixes #9079
Diffstat (limited to 'uitest')
3 files changed, 23 insertions, 1 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaption.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaption.java index 3d32c54a7e..4326d8ac60 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaption.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaption.java @@ -18,6 +18,7 @@ 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.Button; @@ -27,6 +28,7 @@ import com.vaadin.ui.ComboBox; * @author Vaadin Ltd * */ +@Widgetset("com.vaadin.DefaultWidgetSet") public class ComboBoxEmptyCaption extends AbstractTestUI { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSelecting.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSelecting.java index 1a1ac3da03..259e3026dc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSelecting.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSelecting.java @@ -3,12 +3,14 @@ package com.vaadin.tests.components.combobox; import java.util.ArrayList; import java.util.List; +import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Label; import com.vaadin.ui.TextField; +@Widgetset("com.vaadin.DefaultWidgetSet") public class ComboBoxSelecting extends AbstractReindeerTestUI { protected ComboBox<String> comboBox; protected List<String> items = new ArrayList<>(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java index 0cb890dfda..0efea9cae9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java @@ -21,6 +21,8 @@ import java.util.Arrays; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.ComboBoxElement; @@ -74,11 +76,27 @@ public class ComboBoxEmptyCaptionTest extends MultiBrowserTest { "item6", "item7", "item8", "item9", "item10"); } + @Test + public void emptyItemCaptionInTextBox() { + ComboBoxElement combo = $(ComboBoxElement.class).first(); + + Assert.assertEquals("", combo.getInputField().getAttribute("value")); + + // set some caption for the empty selection element + $(ButtonElement.class).first().click(); + + Assert.assertEquals("empty", + combo.getInputField().getAttribute("value")); + + } + private void ensureSuggestions(ComboBoxElement element, String... suggestions) { element.openPopup(); - System.out.println(element.getPopupSuggestions()); Assert.assertEquals(Arrays.asList(suggestions), new ArrayList<>(element.getPopupSuggestions())); + // Close popup + new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform(); } + } |