aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java')
-rw-r--r--uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java b/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
new file mode 100644
index 0000000000..58bc4c5383
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
@@ -0,0 +1,60 @@
+package com.vaadin.tests.components.textfield;
+
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.FieldEvents.TextChangeEvent;
+import com.vaadin.event.FieldEvents.TextChangeListener;
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
+import com.vaadin.ui.TextField;
+
+public class MultipleTextChangeEvents extends TestBase {
+
+ private final Log log = new Log(5);
+
+ @Override
+ public void setup() {
+ TextField tf = new TextField();
+ tf.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
+ tf.setTextChangeTimeout(500);
+ tf.addListener(new TextChangeListener() {
+ @Override
+ public void textChange(TextChangeEvent event) {
+ log.log("TextChangeEvent: " + event.getText());
+ }
+ });
+ getMainWindow().addActionHandler(new MyHandler());
+
+ addComponent(log);
+ addComponent(tf);
+ }
+
+ class MyHandler implements Handler {
+ private static final long serialVersionUID = 1L;
+ Action actionenter = new ShortcutAction("Enter",
+ ShortcutAction.KeyCode.ENTER, null);
+
+ @Override
+ public Action[] getActions(Object theTarget, Object theSender) {
+ return new Action[] { actionenter };
+ }
+
+ @Override
+ public void handleAction(Action theAction, Object theSender,
+ Object theTarget) {
+ log.log("Enter");
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Entering something into the textfield and quickly pressing enter should only send one TextChangeEvent";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(8035);
+ }
+} \ No newline at end of file