Class TreeGridTester
-
- All Implemented Interfaces:
-
com.vaadin.browserless.Clickable
public class TreeGridTester<T extends TreeGrid<Y>, Y> extends GridTester<T, Y>
Tester for TreeGrid components.
Adds the hierarchy interactions a user can perform on top of everything GridTester offers. Row indexes address the rows the user actually sees, so children of collapsed nodes are not counted. The expand toggle lives in the hierarchy column, and aTreeGridcan be configured with none, one, or several of them. expand and collapse require at least one visible hierarchy column, since without one the user has nothing to click. Several hierarchy columns render several toggles for the same node, and clicking any of them has the same effect, so they need no special handling here.- Since:
25.3
-
-
Constructor Summary
Constructors Constructor Description TreeGridTester(T component)Wrap tree grid for testing.
-
Method Summary
Modifier and Type Method Description voidexpand(int row)Expands the node on the given row, as if the user clicked its expand toggle in the browser. voidcollapse(int row)Collapses the node on the given row, as if the user clicked its collapse toggle in the browser. booleanisExpanded(int row)Checks whether the node on the given row is expanded. booleanhasChildren(int row)Checks whether the node on the given row has children, meaning the user is shown an expand toggle for it. StringgetCellText(int row, int column)Get the text that is shown on the client for the cell in the given position. -
Methods inherited from class com.vaadin.browserless.ComponentTester
blur, ensureComponentIsUsable, find, focus, getComponent, isFocused, isUsable, setModal -
Methods inherited from class com.vaadin.flow.component.grid.GridTester
clickRow, clickRow, clickRow, clickRow, contextMenu, deselect, deselectAll, doubleClickRow, doubleClickRow, doubleClickRow, doubleClickRow, getCellComponent, getCellComponent, getColumn, getColumnPosition, getFooterCell, getHeaderCell, getLitRendererPropertyValue, getLitRendererPropertyValue, getRow, getSelected, getSortDirection, getSortDirection, invokeLitRendererFunction, invokeLitRendererFunction, invokeLitRendererFunction, invokeLitRendererFunction, isColumnSortable, isColumnSortable, renderCellComponent, renderCellComponent, select, selectAll, size, sortByColumn, sortByColumn, sortByColumn, sortByColumn -
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
-
-
Constructor Detail
-
TreeGridTester
TreeGridTester(T component)
Wrap tree grid for testing.
- Parameters:
component- target tree grid
-
-
Method Detail
-
expand
void expand(int row)
Expands the node on the given row, as if the user clicked its expand toggle in the browser.
The index is 0 based and counts only rows that are currently displayed, so children of collapsed nodes are skipped. The resulting ExpandEvent reports isFromClient as true.- Parameters:
row- row of the node to expand
-
collapse
void collapse(int row)
Collapses the node on the given row, as if the user clicked its collapse toggle in the browser.
The index is 0 based and counts only rows that are currently displayed, so children of collapsed nodes are skipped. The resulting CollapseEvent reports isFromClient as true.- Parameters:
row- row of the node to collapse
-
isExpanded
boolean isExpanded(int row)
Checks whether the node on the given row is expanded.
The index is 0 based and counts only rows that are currently displayed, so children of collapsed nodes are skipped.- Parameters:
row- row to check- Returns:
true if the node on the row is expanded, otherwise false
-
hasChildren
boolean hasChildren(int row)
Checks whether the node on the given row has children, meaning the user is shown an expand toggle for it.
The index is 0 based and counts only rows that are currently displayed, so children of collapsed nodes are skipped.- Parameters:
row- row to check- Returns:
true if the node on the row has children, otherwise false
-
getCellText
String getCellText(int row, int column)
Get the text that is shown on the client for the cell in the given position.
A hierarchy column added with addHierarchyColumn renders the item through avaadin-grid-tree-toggle, so its text is read from the toggle's own value provider rather than from a column path. Every other column is read exactly as GridTester does.- Parameters:
row- row of cellcolumn- column of cell- Returns:
cell content that is sent to the client
-
-
-
-