summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-11-17 15:49:49 +0200
committerArtur Signell <artur@vaadin.com>2016-11-21 09:20:16 +0000
commit81b2113120485a3eaeadc529a054baf902fcb2ed (patch)
treeff25c5e5d7f914e71249f516b1513f429ed6360c /uitest
parent9a0b4e9827cdcdb4084fb6b61ab7cd8953ee94fb (diff)
downloadvaadin-framework-81b2113120485a3eaeadc529a054baf902fcb2ed.tar.gz
vaadin-framework-81b2113120485a3eaeadc529a054baf902fcb2ed.zip
Mark TextField/TextArea as busy when a text change event is pending (#20469)
Change-Id: I404985ae0be1e7dc65171b610032f8649e700f50
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java58
2 files changed, 64 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java
index b149cbce5c..9788482fc2 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java
@@ -47,6 +47,12 @@ public class TextChangeEvents extends TestBase {
ta.addListener(inputEventListener);
getLayout().addComponent(ta);
+ TextArea tat = new TextArea("Timeout 3s");
+ tat.addListener(inputEventListener);
+ tat.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
+ tat.setTextChangeTimeout(3000);
+ getLayout().addComponent(tat);
+
VaadinDeveloperNameField vd = new VaadinDeveloperNameField();
vd.addListener(inputEventListener);
getLayout().addComponent(vd);
diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java
new file mode 100644
index 0000000000..c000d37d0d
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java
@@ -0,0 +1,58 @@
+package com.vaadin.tests.components.textfield;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TextAreaElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class TextChangeEventsTest extends SingleBrowserTest {
+
+ @Test
+ public void textAreaWaitsForTextChangeEvents() {
+ openTestURL();
+
+ TextAreaElement taDefault = $(TextAreaElement.class)
+ .caption("Default text area").first();
+ taDefault.sendKeys("abc");
+ Assert.assertEquals(
+ "1. Text change event for Default text area, text content currently:'abc' Cursor at index:3",
+ getLogRow(0));
+
+ TextAreaElement taTimeout = $(TextAreaElement.class)
+ .caption("Timeout 3s").first();
+ taTimeout.sendKeys("abc");
+ Assert.assertEquals(
+ "2. Text change event for Timeout 3s, text content currently:'abc' Cursor at index:3",
+ getLogRow(0));
+
+ }
+
+ @Test
+ public void textFieldWaitsForTextChangeEvents() {
+ openTestURL();
+
+ TextFieldElement tfDefault = $(TextFieldElement.class)
+ .caption("Default").first();
+ tfDefault.sendKeys("abc");
+ Assert.assertEquals(
+ "1. Text change event for Default, text content currently:'abc' Cursor at index:3",
+ getLogRow(0));
+
+ TextFieldElement tfEager = $(TextFieldElement.class).caption("Eager")
+ .first();
+ tfEager.sendKeys("abc");
+ Assert.assertEquals(
+ "2. Text change event for Eager, text content currently:'abc' Cursor at index:3",
+ getLogRow(0));
+
+ TextFieldElement tfTimeout = $(TextFieldElement.class)
+ .caption("Timeout 3s").first();
+ tfTimeout.sendKeys("abc");
+ Assert.assertEquals(
+ "3. Text change event for Timeout 3s, text content currently:'abc' Cursor at index:3",
+ getLogRow(0));
+
+ }
+}