Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure DatePicker initializes client side value property #2878

Merged
merged 4 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public class DatePicker extends GeneratedVaadinDatePicker<DatePicker, LocalDate>
*/
public DatePicker() {
sissbruecker marked this conversation as resolved.
Show resolved Hide resolved
this((LocalDate) null, true);
// Trigger model-to-presentation conversion in constructor, so that
// the client side component has a correct initial value of an empty
// string
sissbruecker marked this conversation as resolved.
Show resolved Hide resolved
this.setPresentationValue(null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void datePicker_basicCases() {
DatePicker picker = new DatePicker();

Assert.assertNull(picker.getValue());
Assert.assertFalse(picker.getElement().hasProperty("value"));
Assert.assertEquals("", picker.getElement().getProperty("value"));

picker.setValue(LocalDate.of(2018, 4, 25));
Assert.assertEquals("2018-04-25",
Expand All @@ -73,7 +73,7 @@ public void datePicker_basicCases() {
public void defaultCtor_does_not_update_values() {
DatePicker picker = new DatePicker();
Assert.assertNull(picker.getValue());
Assert.assertNull(picker.getElement().getProperty("value"));
Assert.assertEquals("", picker.getElement().getProperty("value"));
}

@Test
Expand Down