diff options
author | Johannes Dahlström <johannes.dahlstrom@vaadin.com> | 2013-05-02 13:48:45 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-10 13:27:29 +0000 |
commit | bdb793187c513121cc3b4732b053ba549d94e7b8 (patch) | |
tree | a644eccd3549f5c18d985588c45b542dfacab07e | |
parent | 21d9b67d8bf5841aee0116fef031f549b3417af9 (diff) | |
download | vaadin-framework-bdb793187c513121cc3b4732b053ba549d94e7b8.tar.gz vaadin-framework-bdb793187c513121cc3b4732b053ba549d94e7b8.zip |
Merge test for #11623 to 7.0.
The fix itself is not required due to the changed style name handling.
svn changeset:25902/svn branch:6.8
svn changeset:25903/svn branch:6.8
Change-Id: I95a9adbcac82236017369003765735bbaacfe980
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.html | 72 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java | 69 |
2 files changed, 141 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.html b/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.html new file mode 100644 index 0000000000..d0dec8ce40 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.html @@ -0,0 +1,72 @@ +<?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="http://localhost:8068/" /> +<title>TextChangeListenerLosesFocus</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TextChangeListenerLosesFocus</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.textfield.TextChangeListenerLosesFocus?restartApplication</td> + <td></td> +</tr> +<tr> + <td>focus</td> + <td>test-textfield</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>test-textfield</td> + <td>123</td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<tr> + <td>assertValue</td> + <td>test-textfield</td> + <td>Updated by TextChangeListener</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>test-textfield</td> + <td>v-textfield-focus</td> +</tr> +<tr> + <td>focus</td> + <td>test-textarea</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>test-textarea</td> + <td>123</td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<tr> + <td>assertValue</td> + <td>test-textarea</td> + <td>Updated by TextChangeListener</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>test-textarea</td> + <td>v-textarea-focus</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java b/uitest/src/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java new file mode 100644 index 0000000000..25ca46333a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java @@ -0,0 +1,69 @@ +/* + * Copyright 2012 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.components.textfield; + +import com.vaadin.event.FieldEvents.TextChangeEvent; +import com.vaadin.event.FieldEvents.TextChangeListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.TestUtils; +import com.vaadin.ui.AbstractTextField; +import com.vaadin.ui.Field; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; + +public class TextChangeListenerLosesFocus extends TestBase { + + private final TextChangeListener listener = new TextChangeListener() { + public void textChange(TextChangeEvent event) { + final String value = event.getText(); + if (value.length() > 2) { + ((Field) event.getComponent()) + .setValue("Updated by TextChangeListener"); + } + } + }; + + @Override + protected void setup() { + TestUtils.injectCSS(getMainWindow(), + ".v-textfield-focus, .v-textarea-focus { " + + " background: #E8F0FF !important }"); + + AbstractTextField field = new TextField(); + field.setDebugId("test-textfield"); + field.setInputPrompt("Enter at least 3 characters"); + field.addListener(listener); + addComponent(field); + + field = new TextArea(); + field.setDebugId("test-textarea"); + field.setInputPrompt("Enter at least 3 characters"); + field.addListener(listener); + addComponent(field); + + } + + @Override + protected String getDescription() { + return "Updating a focused TextField overwrites the focus stylename"; + } + + @Override + protected Integer getTicketNumber() { + return 11623; + } +} |