diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2017-06-29 10:30:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-29 10:30:57 +0300 |
commit | 9c3868e897541c014e19341f3d58066734f8a6c0 (patch) | |
tree | 6e0d00326c37e80d6478895e5a2470b6a203e445 /server/src/test | |
parent | b2c0ac2bac558a4bc497fa3a6d29b8f030511e1a (diff) | |
download | vaadin-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.java | 23 |
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); |