diff options
author | Adam Wagner <wbadam@users.noreply.github.com> | 2018-02-02 12:25:35 +0200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-02-02 12:25:35 +0200 |
commit | d2ef29e5b41d45f291d087760b02e212c75ff9eb (patch) | |
tree | f13c6e19627f96c11a8edce9d49e72e6867f3ed6 /uitest/src/main/java/com/vaadin/tests | |
parent | 875c98972e9c3da25a7c9c54cb267871921d4804 (diff) | |
download | vaadin-framework-d2ef29e5b41d45f291d087760b02e212c75ff9eb.tar.gz vaadin-framework-d2ef29e5b41d45f291d087760b02e212c75ff9eb.zip |
Add flush() implementation to DateField (#10518)
Fixes #10488
Diffstat (limited to 'uitest/src/main/java/com/vaadin/tests')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldShortcut.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldShortcut.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldShortcut.java new file mode 100644 index 0000000000..406e13a5a3 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldShortcut.java @@ -0,0 +1,44 @@ +package com.vaadin.tests.components.datefield; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.event.ShortcutListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DateField; +import com.vaadin.ui.Notification; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class DateFieldShortcut extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + String dateFormat = "dd/MM/yyyy"; + + DateField dateField = new DateField(); + dateField.setValue(LocalDate.of(2018, 1, 11)); + dateField.setDateFormat(dateFormat); + + dateField.addShortcutListener( + new ShortcutListener("Enter", KeyCode.ENTER, null) { + @Override + public void handleAction(Object sender, Object target) { + Notification.show(dateField.getValue() + .format(DateTimeFormatter + .ofPattern(dateFormat))); + } + }); + + addComponent(dateField); + } + + @Override + protected String getTestDescription() { + return "Modify the date maually (without using the popup element) and" + + " then press Enter. The notification should show the modified" + + " value instead of the old value."; + } +} |