aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/test
diff options
context:
space:
mode:
authorDenis <denis@vaadin.com>2017-01-27 15:44:03 +0200
committerGitHub <noreply@github.com>2017-01-27 15:44:03 +0200
commit9ef479303bb514622ef90d95b94d912780c1812d (patch)
treefd6929a4b396cb6b1ff290ded4e129cd60415d60 /server/src/test
parent5616216306a138b3437d188e4b2df8253590abf5 (diff)
downloadvaadin-framework-9ef479303bb514622ef90d95b94d912780c1812d.tar.gz
vaadin-framework-9ef479303bb514622ef90d95b94d912780c1812d.zip
Introduce empty selection functionality for NativeSelect. (#8336)
* Introduce empty selection functionality for NativeSelect. Fixes vaadin/framework8-issues#545
Diffstat (limited to 'server/src/test')
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java21
2 files changed, 26 insertions, 2 deletions
diff --git a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java
index 1677f8699b..e2a0c67f2a 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java
@@ -48,12 +48,14 @@ public class ComboBoxDeclarativeTest
int pageLength = 7;
String popupWidth = "11%";
boolean emptySelectionAllowed = false;
+ String emptySelectionCaption = "foo";
String design = String.format(
"<%s placeholder='%s' text-input-allowed='%s' page-length='%d' "
- + "popup-width='%s' empty-selection-allowed='%s' scroll-to-selected-item/>",
+ + "popup-width='%s' empty-selection-allowed='%s' "
+ + "scroll-to-selected-item empty-selection-caption='%s'/>",
getComponentTag(), placeholder, textInputAllowed, pageLength,
- popupWidth, emptySelectionAllowed);
+ popupWidth, emptySelectionAllowed, emptySelectionCaption);
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setPlaceholder(placeholder);
@@ -62,6 +64,7 @@ public class ComboBoxDeclarativeTest
comboBox.setPopupWidth(popupWidth);
comboBox.setScrollToSelectedItem(true);
comboBox.setEmptySelectionAllowed(emptySelectionAllowed);
+ comboBox.setEmptySelectionCaption(emptySelectionCaption);
testRead(design, comboBox);
testWrite(design, comboBox);
diff --git a/server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java
index 2b80546e80..fea6ac3b12 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.tests.server.component.nativeselect;
+import org.junit.Test;
+
import com.vaadin.tests.server.component.abstractsingleselect.AbstractSingleSelectDeclarativeTest;
import com.vaadin.ui.NativeSelect;
@@ -29,6 +31,25 @@ import com.vaadin.ui.NativeSelect;
public class NativeSelectDeclarativeTest
extends AbstractSingleSelectDeclarativeTest<NativeSelect> {
+ @Test
+ public void nativeSelectSpecificPropertiesSerialize() {
+ boolean emptySelectionAllowed = false;
+ String emptySelectionCaption = "foo";
+
+ String design = String.format(
+ "<%s empty-selection-allowed='%s' "
+ + "empty-selection-caption='%s'/>",
+ getComponentTag(), emptySelectionAllowed,
+ emptySelectionCaption);
+
+ NativeSelect<String> select = new NativeSelect<>();
+ select.setEmptySelectionAllowed(emptySelectionAllowed);
+ select.setEmptySelectionCaption(emptySelectionCaption);
+
+ testRead(design, select);
+ testWrite(design, select);
+ }
+
@Override
protected String getComponentTag() {
return "vaadin-native-select";