aboutsummaryrefslogtreecommitdiffstats
path: root/server/tests/src/com/vaadin/ui/TextFieldTest.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-09-24 17:56:36 +0300
committerVaadin Code Review <review@vaadin.com>2014-09-26 12:40:14 +0000
commit99b1c1a7936f250885e647983d7e30fd3a7f1018 (patch)
tree51141abb0ed9c1dbca20b31702ab014a559a377e /server/tests/src/com/vaadin/ui/TextFieldTest.java
parentd516791e28e861893fb5082472a1c0ca59f0dfd7 (diff)
downloadvaadin-framework-99b1c1a7936f250885e647983d7e30fd3a7f1018.tar.gz
vaadin-framework-99b1c1a7936f250885e647983d7e30fd3a7f1018.zip
Add clear() for fields and field group (#14755)
Change-Id: If9372ccceeaacd0826f8b1ed07f64af12bf47fc6
Diffstat (limited to 'server/tests/src/com/vaadin/ui/TextFieldTest.java')
-rw-r--r--server/tests/src/com/vaadin/ui/TextFieldTest.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/ui/TextFieldTest.java b/server/tests/src/com/vaadin/ui/TextFieldTest.java
new file mode 100644
index 0000000000..bfd452bd3b
--- /dev/null
+++ b/server/tests/src/com/vaadin/ui/TextFieldTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2000-2014 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.ui;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.data.util.ObjectProperty;
+
+public class TextFieldTest {
+
+ @Test
+ public void initiallyEmpty() {
+ TextField tf = new TextField();
+ Assert.assertTrue(tf.isEmpty());
+ }
+
+ @Test
+ public void emptyAfterClearUsingPDS() {
+ TextField tf = new TextField(new ObjectProperty<String>("foo"));
+ Assert.assertFalse(tf.isEmpty());
+ tf.clear();
+ Assert.assertTrue(tf.isEmpty());
+ }
+
+ @Test
+ public void emptyAfterClear() {
+ TextField tf = new TextField();
+ tf.setValue("foobar");
+ Assert.assertFalse(tf.isEmpty());
+ tf.clear();
+ Assert.assertTrue(tf.isEmpty());
+ }
+
+}