aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2010-08-12 08:40:25 +0000
committerArtur Signell <artur.signell@itmill.com>2010-08-12 08:40:25 +0000
commitf55b49ae95c27c91e76a7ac5b94efb9287da8176 (patch)
tree8966d71067099e40d1b97e1ee936619d9a4ba261
parent7626e2787b0ff0b7dd8c6cab79756c34707255a1 (diff)
downloadvaadin-framework-f55b49ae95c27c91e76a7ac5b94efb9287da8176.tar.gz
vaadin-framework-f55b49ae95c27c91e76a7ac5b94efb9287da8176.zip
Test case for #5433
svn changeset:14464/svn branch:6.4
-rw-r--r--tests/src/com/vaadin/tests/components/form/FormWithEnterShortCut.java48
-rw-r--r--tests/src/com/vaadin/tests/components/form/FormWithEnterShortcut.html47
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/form/FormWithEnterShortCut.java b/tests/src/com/vaadin/tests/components/form/FormWithEnterShortCut.java
new file mode 100644
index 0000000000..4a2e03e5a6
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/form/FormWithEnterShortCut.java
@@ -0,0 +1,48 @@
+package com.vaadin.tests.components.form;
+
+import com.vaadin.event.ShortcutAction.KeyCode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.TextField;
+
+public class FormWithEnterShortCut extends TestBase {
+ private Log log = new Log(2);
+
+ @Override
+ protected void setup() {
+ log.setNumberLogRows(true);
+
+ final Form form = new Form();
+ final Field tf = new TextField("Search");
+ form.addField("searchfield", tf);
+
+ Button button = new Button("Go");
+ button.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ log.log("search: " + tf.getValue());
+ }
+ });
+ button.setClickShortcut(KeyCode.ENTER);
+ button.setStyleName("primary");
+
+ form.getFooter().addComponent(button);
+
+ addComponent(log);
+ addComponent(form);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Focusing a button and pressing enter (which is a shortcut for button click) should only produce one click event";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5433;
+ }
+}
diff --git a/tests/src/com/vaadin/tests/components/form/FormWithEnterShortcut.html b/tests/src/com/vaadin/tests/components/form/FormWithEnterShortcut.html
new file mode 100644
index 0000000000..16c5b1cee4
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/form/FormWithEnterShortcut.html
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.form.FormWithEnterShortCut?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsformFormWithEnterShortCut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+ <td>70,4</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentsformFormWithEnterShortCut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+ <td>abc</td>
+</tr>
+<tr>
+ <td>focus</td>
+ <td>vaadin=runcomvaadintestscomponentsformFormWithEnterShortCut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VForm[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>tab</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsformFormWithEnterShortCut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VForm[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsformFormWithEnterShortCut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>1. search: abc</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>