Class DashboardTester<T extends Dashboard>
java.lang.Object
com.vaadin.browserless.ComponentTester<T>
com.vaadin.flow.component.dashboard.DashboardTester<T>
- Type Parameters:
T- the dashboard type
- All Implemented Interfaces:
Clickable<T>
Tester for the
Dashboard component.
Simulates the interactions a user performs on an editable dashboard:
reordering, resizing and removing widgets. Each method fires the same
client-side event the web component sends, so the dashboard updates its
server-side model and notifies any registered listeners exactly as it would
in a browser. All three actions require the dashboard to be editable
(Dashboard.setEditable(boolean)), mirroring the component: a user
cannot move, resize or remove widgets otherwise.
- Since:
- 1.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidmoveWidget(DashboardWidget widget, int toIndex) Simulates a user dragging the given widget to a new position within its current container (the dashboard root, or the section it belongs to).voidremoveWidget(DashboardWidget widget) Simulates a user removing the given widget by clicking its remove button.voidresizeWidget(DashboardWidget widget, int colspan, int rowspan) Simulates a user resizing the given widget to the given column and row span.Methods inherited from class com.vaadin.browserless.ComponentTester
ensureComponentIsUsable, ensureComponentIsUsable, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isUsable, isUsable, notUsableReasons, notUsableReasons, roundTrip, setModal, setValueAsUserMethods 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, rightClick
-
Constructor Details
-
DashboardTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
moveWidget
Simulates a user dragging the given widget to a new position within its current container (the dashboard root, or the section it belongs to).- Parameters:
widget- the widget to move, notnulltoIndex- the target index among the widget's siblings- Throws:
IllegalStateException- if the dashboard is not editableIllegalArgumentException- if the widget is not in this dashboard or the target index is out of bounds
-
resizeWidget
Simulates a user resizing the given widget to the given column and row span.- Parameters:
widget- the widget to resize, notnullcolspan- the new column spanrowspan- the new row span- Throws:
IllegalStateException- if the dashboard is not editableIllegalArgumentException- if the widget is not in this dashboard
-
removeWidget
Simulates a user removing the given widget by clicking its remove button.If the dashboard has a custom
remove handler, it receives the event and decides whether to remove the widget; otherwise the widget is removed immediately.- Parameters:
widget- the widget to remove, notnull- Throws:
IllegalStateException- if the dashboard is not editableIllegalArgumentException- if the widget is not in this dashboard
-