diff options
author | Anastasia Smirnova <anasmi@utu.fi> | 2019-04-04 10:00:46 +0300 |
---|---|---|
committer | Sun Zhe <31067185+ZheSun88@users.noreply.github.com> | 2019-04-04 10:00:46 +0300 |
commit | 049e6f39aadab1785d78bceaac575d25ea56dad4 (patch) | |
tree | 4c61adaa0b255ab8de9a3f7d15e6b3d9b3210ca7 /uitest | |
parent | 0035aa1d7a8645a3759d27864b95d83a4b8c2475 (diff) | |
download | vaadin-framework-049e6f39aadab1785d78bceaac575d25ea56dad4.tar.gz vaadin-framework-049e6f39aadab1785d78bceaac575d25ea56dad4.zip |
Read-only combobox should not handle PASTE event (#11529)
Fixes 11528
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPaste.java | 25 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPasteTest.java | 22 |
2 files changed, 47 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPaste.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPaste.java new file mode 100644 index 0000000000..d2e7126604 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPaste.java @@ -0,0 +1,25 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; + +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class ComboboxReadOnlyPaste extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + ComboBox<String> nameComboBox = new ComboBox<>("Name"); + nameComboBox.setId("readOnlyCB"); + nameComboBox.setEmptySelectionAllowed(true); + nameComboBox.setItems( + Stream.of("A", "B", "C", "D").collect(Collectors.toList())); + nameComboBox.setValue("B"); + nameComboBox.setReadOnly(true); + + addComponent(nameComboBox); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPasteTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPasteTest.java new file mode 100644 index 0000000000..07e73bd95c --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxReadOnlyPasteTest.java @@ -0,0 +1,22 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Test; +import org.openqa.selenium.Keys; + +import static org.junit.Assert.assertFalse; + +public class ComboboxReadOnlyPasteTest extends MultiBrowserTest { + + @Test + public void popupNotOpened() { + openTestURL(); + ComboBoxElement cb = $(ComboBoxElement.class).first(); + cb.click(); + String paste = Keys.chord(Keys.CONTROL, "v"); + cb.sendKeys(paste); + assertFalse("Pop-up should not be opened in read-only mode", + cb.isPopupOpen()); + } +} |