Class DateTimePickerLocator
- All Implemented Interfaces:
Clickable<com.vaadin.flow.component.datetimepicker.DateTimePicker>,HasLabelFilter<com.vaadin.flow.component.datetimepicker.DateTimePicker,,DateTimePickerLocator> HasThemeFilter<com.vaadin.flow.component.datetimepicker.DateTimePicker,,DateTimePickerLocator> HasValueFilter<com.vaadin.flow.component.datetimepicker.DateTimePicker,LocalDateTime, DateTimePickerLocator>
DateTimePicker, derived from
DateTimePickerTester. Filter steps are inherited from
Locator; action methods delegate to a fresh tester
around the resolved component, so behavioral changes belong on the
tester, not here.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a locator that searches for aDateTimePicker.DateTimePickerLocator(com.vaadin.flow.component.datetimepicker.DateTimePicker component) Creates a locator already bound to the given component, so that the action methods run against it instead of against a lookup. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Empties the field, as when the user deletes its contents (or clicks the clear button, where one is shown).voidEnsures the component is in a usable state before interaction.com.vaadin.flow.component.datetimepicker.DateTimePickerGets the component being tested.booleanisValid()Checks whether the field is currently valid, applying the same constraints as the component itself — required, min and max — and honouring an invalid state set from the outside, as aBinderor a custom validator does.voidsetValue(LocalDateTime dateTime) Set the date to the component, as the user would enter it.Methods inherited from class com.vaadin.browserless.locator.Locator
atIndex, component, components, exists, inside, inside, invalidate, self, with, withAttribute, withAttribute, withClassName, withCondition, withCondition, withId, withinSlot, withoutAttribute, withoutAttribute, withoutClassName, withTestIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.browserless.Clickable
click, click, click, middleClick, middleClick, rightClick, rightClickMethods inherited from interface com.vaadin.browserless.locator.HasLabelFilter
withLabel, withLabelContainingMethods inherited from interface com.vaadin.browserless.locator.HasThemeFilter
withoutTheme, withoutTheme, withTheme, withThemeMethods inherited from interface com.vaadin.browserless.locator.HasValueFilter
withValue
-
Constructor Details
-
DateTimePickerLocator
public DateTimePickerLocator()Creates a locator that searches for aDateTimePicker. -
DateTimePickerLocator
public DateTimePickerLocator(com.vaadin.flow.component.datetimepicker.DateTimePicker component) Creates a locator already bound to the given component, so that the action methods run against it instead of against a lookup.- Parameters:
component- the component the locator resolves to
-
-
Method Details
-
getComponent
public com.vaadin.flow.component.datetimepicker.DateTimePicker getComponent()Description copied from interface:ClickableGets the component being tested.- Specified by:
getComponentin interfaceClickable<com.vaadin.flow.component.datetimepicker.DateTimePicker>- Returns:
- the component under test
-
ensureComponentIsUsable
public void ensureComponentIsUsable()Description copied from interface:ClickableEnsures the component is in a usable state before interaction.- Specified by:
ensureComponentIsUsablein interfaceClickable<com.vaadin.flow.component.datetimepicker.DateTimePicker>
-
setValue
Set the date to the component, as the user would enter it.A value that violates the component's constraints — outside min - max, or the empty value on a required field — is committed all the same, because the browser commits it too and simply leaves the field invalid. Assert that outcome with
DateTimePickerTester.isValid()instead of expecting this method to throw. Javadoc copied fromDateTimePickerTester.setValue(java.time.LocalDateTime).- Parameters:
dateTime- date time to set to component- Throws:
IllegalStateException- if the component is not usable
-
isValid
public boolean isValid()Checks whether the field is currently valid, applying the same constraints as the component itself — required, min and max — and honouring an invalid state set from the outside, as aBinderor a custom validator does.A field can hold a value that does not satisfy its constraints — the user can type one,
DateTimePickerTester.setValue(java.time.LocalDateTime)commits it as the browser does, and the value can also be set on the server — so a test asserting on validation state checks this instead of expecting a value to be refused. Javadoc copied fromDateTimePickerTester.isValid().- Returns:
trueif the field is not marked invalid and its current value satisfies the constraints of the field- Since:
- 25.3
-
clear
public void clear()Empties the field, as when the user deletes its contents (or clicks the clear button, where one is shown).Emptying is something the user can always do, so it needs no clear button: a field may legitimately end up invalid — a required field, for instance — once emptied. Javadoc copied from
DateTimePickerTester.clear().- Throws:
IllegalStateException- if the component is not usable- Since:
- 25.3
-