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 /uitest/src | |
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
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java | 69 |
1 files changed, 69 insertions, 0 deletions
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; + } +} |