aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2015-07-07 21:49:45 +0300
committerLeif Åstrand <leif@vaadin.com>2015-09-08 07:40:15 +0000
commit7c559ce9eaa7258235885aad7553748e18f20a12 (patch)
tree89baac806844810322be08519dbc1cdc3176a268 /uitest
parenta2929d3f48366da13f717fe1cd30c6a914c079a7 (diff)
downloadvaadin-framework-7c559ce9eaa7258235885aad7553748e18f20a12.tar.gz
vaadin-framework-7c559ce9eaa7258235885aad7553748e18f20a12.zip
Make it possible to avoid select caption conversion (#16845)
Change-Id: If88b7cf6298a24cfad3c936a1af566ed919ec0e7
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/select/SelectWithIntegers.java46
-rw-r--r--uitest/src/com/vaadin/tests/components/select/SelectWithIntegersTest.java37
2 files changed, 83 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/select/SelectWithIntegers.java b/uitest/src/com/vaadin/tests/components/select/SelectWithIntegers.java
new file mode 100644
index 0000000000..3012105ae9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/select/SelectWithIntegers.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tests.components.select;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.ListSelect;
+
+public class SelectWithIntegers extends AbstractTestUI {
+ private final List<Integer> years = Arrays.asList(2014, 2015, 2016);
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(createSelect("Default", null));
+ addComponent(createSelect("ID_TOSTRING", ItemCaptionMode.ID_TOSTRING));
+ }
+
+ private AbstractSelect createSelect(String caption, ItemCaptionMode mode) {
+ ListSelect listSelect = new ListSelect(caption, years);
+ listSelect.setRows(years.size());
+ listSelect.setNullSelectionAllowed(false);
+ if (mode != null) {
+ listSelect.setItemCaptionMode(mode);
+ }
+ return listSelect;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/select/SelectWithIntegersTest.java b/uitest/src/com/vaadin/tests/components/select/SelectWithIntegersTest.java
new file mode 100644
index 0000000000..bbef30bf1d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/select/SelectWithIntegersTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.tests.components.select;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ListSelectElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class SelectWithIntegersTest extends SingleBrowserTest {
+ @Test
+ public void testSelectWithIntegers() {
+ openTestURL();
+
+ ListSelectElement defaultSelect = $(ListSelectElement.class).caption(
+ "Default").first();
+ ListSelectElement toStringSelect = $(ListSelectElement.class).caption(
+ "ID_TOSTRING").first();
+
+ Assert.assertEquals("2,014", defaultSelect.getOptions().get(0));
+ Assert.assertEquals("2014", toStringSelect.getOptions().get(0));
+ }
+}