summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-11-22 08:31:56 +0100
committerPekka Maanpää <pekkamaa@vaadin.com>2017-11-22 09:31:56 +0200
commitbdceccd1aa779ec8facc71320678bf7a0bfa4628 (patch)
tree48c722c5f606f17cf5de294ef8009776b8e5212a /uitest/src
parent3569a33239693461d588dbfd1005730943118702 (diff)
downloadvaadin-framework-bdceccd1aa779ec8facc71320678bf7a0bfa4628.tar.gz
vaadin-framework-bdceccd1aa779ec8facc71320678bf7a0bfa4628.zip
Disabled ComboBox should not open popup on pasting (Fixes #7898) (#10240)
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabled.java26
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java1
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabledTest.java44
3 files changed, 71 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabled.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabled.java
new file mode 100644
index 0000000000..c7347fe9c5
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabled.java
@@ -0,0 +1,26 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxPasteWithDisabled extends AbstractTestUI {
+
+ @Override
+ public String getDescription() {
+ return "Paste from Clipboard should not open the popup of a disabled ComboBox";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7898;
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ ComboBox<String> comboBox = new ComboBox<>();
+ comboBox.setEnabled(false);
+ addComponent(comboBox);
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java
index fb967819f9..a221a1ac00 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java
@@ -24,6 +24,7 @@ import com.vaadin.testbench.elements.ComboBoxElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class ComboBoxCombinedWithEnterShortcutTest extends MultiBrowserTest {
+
@Test
public void testKeyboardSelection() throws InterruptedException {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabledTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabledTest.java
new file mode 100644
index 0000000000..10d0db5d3d
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPasteWithDisabledTest.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.combobox;
+
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ComboBoxPasteWithDisabledTest extends MultiBrowserTest {
+
+ @Test
+ public void pasteWithDisabled() throws InterruptedException {
+ openTestURL();
+ ComboBoxElement cb = $(ComboBoxElement.class).first();
+
+ cb.click();
+
+ WebElement input = cb.getInputField();
+ JavascriptExecutor js = (JavascriptExecutor) getDriver();
+
+ // .sendKeys() doesn't allow sending to a disabled element
+ js.executeScript("arguments[0].removeAttribute('disabled')", input);
+
+ String os = System.getProperty("os.name").toLowerCase();
+ String paste;
+ if (os.contains("windows")) {
+ paste = Keys.chord(Keys.CONTROL, "v");
+ } else if (os.contains("linux")) {
+ paste = Keys.chord(Keys.CONTROL, Keys.SHIFT, "v");
+ } else {
+ // mac
+ paste = Keys.chord(Keys.COMMAND, "v");
+ }
+
+ input.sendKeys(paste);
+
+ assertFalse(cb.isPopupOpen());
+ }
+
+}