summaryrefslogtreecommitdiffstats
path: root/server/src/test
diff options
context:
space:
mode:
authorIlia Motornyi <elmot@vaadin.com>2017-06-29 10:30:57 +0300
committerGitHub <noreply@github.com>2017-06-29 10:30:57 +0300
commit9c3868e897541c014e19341f3d58066734f8a6c0 (patch)
tree6e0d00326c37e80d6478895e5a2470b6a203e445 /server/src/test
parentb2c0ac2bac558a4bc497fa3a6d29b8f030511e1a (diff)
downloadvaadin-framework-9c3868e897541c014e19341f3d58066734f8a6c0.tar.gz
vaadin-framework-9c3868e897541c014e19341f3d58066734f8a6c0.zip
Add an optional HasValue to a ValueContext
Diffstat (limited to 'server/src/test')
-rw-r--r--server/src/test/java/com/vaadin/data/ValueContextTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/src/test/java/com/vaadin/data/ValueContextTest.java b/server/src/test/java/com/vaadin/data/ValueContextTest.java
index 2f13a71dbb..b96f7463cb 100644
--- a/server/src/test/java/com/vaadin/data/ValueContextTest.java
+++ b/server/src/test/java/com/vaadin/data/ValueContextTest.java
@@ -3,6 +3,7 @@ package com.vaadin.data;
import java.util.Locale;
import java.util.Objects;
+import com.vaadin.ui.CheckBox;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -46,6 +47,28 @@ public class ValueContextTest extends UI {
Locale.getDefault(), locale);
}
+ @Test
+ public void testHasValue1() {
+ setLocale(null);
+ ValueContext fromComponent = new ValueContext(textField);
+ Assert.assertEquals(textField, fromComponent.getHasValue().get());
+ }
+
+ @Test
+ public void testHasValue2() {
+ setLocale(null);
+ ValueContext fromComponent = new ValueContext(new CheckBox(), textField);
+ Assert.assertEquals(textField, fromComponent.getHasValue().get());
+ }
+
+ @Test
+ public void testHasValue3() {
+ setLocale(null);
+ ValueContext fromComponent = new ValueContext(new CheckBox(), textField, Locale.CANADA);
+ Assert.assertEquals(textField, fromComponent.getHasValue().get());
+ Assert.assertEquals(Locale.CANADA, fromComponent.getLocale().get());
+ }
+
@Before
public void setUp() {
setLocale(UI_LOCALE);