summaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorOlli Tietäväinen <ollit@vaadin.com>2017-08-10 15:57:27 +0300
committerHenri Sara <henri.sara@gmail.com>2017-08-10 15:57:27 +0300
commit66e68f1ef25804dabfb4b0e4cdd7d59c66522927 (patch)
tree47190488a16fc39a87305878516a58cf00d1dcc7 /uitest/src/test
parent24473c8deac75d9ac229252a81b534ba0e62b31c (diff)
downloadvaadin-framework-66e68f1ef25804dabfb4b0e4cdd7d59c66522927.tar.gz
vaadin-framework-66e68f1ef25804dabfb4b0e4cdd7d59c66522927.zip
Enable setting non-selected default value for DateField (#9745)
Requested feature: allow setting DateField to a certain starting point without selecting a value.
Diffstat (limited to 'uitest/src/test')
-rwxr-xr-xuitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValueTest.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValueTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValueTest.java
new file mode 100755
index 0000000000..964b6bbecb
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValueTest.java
@@ -0,0 +1,46 @@
+package com.vaadin.tests.components.datefield;
+
+import static com.vaadin.tests.components.datefield.DateFieldWithDefaultValue.DATEFIELD_HAS_DEFAULT;
+import static com.vaadin.tests.components.datefield.DateFieldWithDefaultValue.DATEFIELD_REGULAR;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.DateFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class DateFieldWithDefaultValueTest extends MultiBrowserTest {
+
+ @Test
+ public void testDateFieldDefaultValue() {
+ openTestURL();
+ String datePickerId = DATEFIELD_HAS_DEFAULT;
+ getDateFieldElement(datePickerId).openPopup();
+ WebElement monthSpanElement = getMonthSpanFromVisibleCalendarPanel();
+ // Can't check for "October 2010", since IE11 translates October ->
+ // lokakuu
+ assert (monthSpanElement.getText().contains("2010"));
+ }
+
+ @Test
+ public void testDateFieldWithNoDefault() {
+ openTestURL();
+ String datePickerId = DATEFIELD_REGULAR;
+ getDateFieldElement(datePickerId).openPopup();
+ WebElement monthSpanElement = getMonthSpanFromVisibleCalendarPanel();
+ assert (!monthSpanElement.getText().contains("2010"));
+ }
+
+ private WebElement getMonthSpanFromVisibleCalendarPanel() {
+ return getDriver()
+ .findElements(
+ By.cssSelector(".v-datefield-calendarpanel-month"))
+ .get(0);
+ }
+
+ private DateFieldElement getDateFieldElement(String id) {
+ return $(DateFieldElement.class).id(id);
+ }
+
+}