Class DialogTester
-
- All Implemented Interfaces:
-
com.vaadin.browserless.Clickable
public class DialogTester extends ComponentTester<Dialog>
- Since:
1.0
-
-
Constructor Summary
Constructors Constructor Description DialogTester(Dialog component)Wrap given component for testing.
-
Method Summary
Modifier and Type Method Description voidopen()Open the dialog. voidclose()Close the dialog from the server side, like the application calling close. voidpressEscape()Simulates pressing Escape to close the dialog. voidclickOutside()Simulates clicking outside the dialog to close it. booleanisOpen()Check if the dialog is open. booleanisUsable()Validate that component can be interacted with and should be visible in the UI. <R extends Component> ComponentQuery<R>findInHeader(Class<R> componentType)Searches the dialog's header for components of the given type. <R extends Component> ComponentQuery<R>findInFooter(Class<R> componentType)Searches the dialog's footer for components of the given type. -
Methods inherited from class com.vaadin.browserless.ComponentTester
blur, ensureComponentIsUsable, find, focus, getComponent, isFocused, setModal -
Methods inherited from class com.vaadin.browserless.Clickable
click, click, click, middleClick, middleClick, rightClick, rightClick -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
open
void open()
Open the dialog.
-
close
void close()
Close the dialog from the server side, like the application calling close.
This is not something the user can do: the dialog is closed regardless of isCloseOnEsc and isCloseOnOutsideClick, and no Dialog.DialogCloseActionEvent is fired, so a close action listener cannot veto it. To simulate the user dismissing the dialog, use pressEscape or clickOutside instead.
-
pressEscape
void pressEscape()
Simulates pressing Escape to close the dialog.
If the application has registered a close action listener, a Dialog.DialogCloseActionEvent is fired instead of closing the dialog, leaving it up to the listener whether to close it.
- Since:
25.3
-
clickOutside
void clickOutside()
Simulates clicking outside the dialog to close it.
If the application has registered a close action listener, a Dialog.DialogCloseActionEvent is fired instead of closing the dialog, leaving it up to the listener whether to close it.
- Since:
25.3
-
isOpen
boolean isOpen()
Check if the dialog is open.
- Returns:
true if the dialog is open
- Since:
25.3
-
isUsable
boolean isUsable()
Validate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also override notUsableReasons to provide additional details to the potential exception thrown by ensureComponentIsUsable.
- Returns:
trueif component can be interacted with by the user
-
findInHeader
<R extends Component> ComponentQuery<R> findInHeader(Class<R> componentType)
Searches the dialog's header for components of the given type.
The header is the area above the dialog content, filled with
dialog.getHeader().add(...). Components nested inside the header content are found too, so a button inside a header layout is reached as well as a button added to the header directly.- Parameters:
componentType- the type of the components to search for- Returns:
a query for components of the given type in the dialog's header
- Since:
25.3
-
findInFooter
<R extends Component> ComponentQuery<R> findInFooter(Class<R> componentType)
Searches the dialog's footer for components of the given type.
The footer is the area below the dialog content, filled with
dialog.getFooter().add(...). Components nested inside the footer content are found too, so a button inside a footer layout is reached as well as a button added to the footer directly.- Parameters:
componentType- the type of the components to search for- Returns:
a query for components of the given type in the dialog's footer
- Since:
25.3
-
-
-
-