com.vaadin.flow.component.tabs.
Class TabsTester<T extends Tabs>
Type Parameters:
T
- component type
Tester for Tabs components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTab
(int index) Gets the visible tab at given index.
Gets the visible tab with the given label.
boolean
isSelected
(int index) Checks if the visible tab at the given index is currently selected.
boolean
isSelected
(String label) Checks if the tab with the given label is currently selected.
void
select
(int index) Selects a visible tab based on its zero-based index.
void
Selects the tab with the given label.
Methods inherited from class com.vaadin.testbench.unit.ComponentTester
ensureComponentIsUsable, ensureComponentIsUsable, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isUsable, isUsable, notUsableReasons, notUsableReasons, roundTrip, setModal
-
Constructor Details
-
TabsTester
Wrap given component for testing.
Parameters:
component
- target component
-
-
Method Details
-
select
Selects the tab with the given label.
Parameters:
label
- the tab label -
select
public void select(int index) Selects a visible tab based on its zero-based index.
The
index
refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to select tab 'C', the call must beselect(1)
and notselect(2)
.Parameters:
index
- the zero-based index of the selected tab, negative value to unselectThrows:
IllegalStateException
- if tab at given index is not visible in the browserIllegalArgumentException
- if theindex
is less than zero or greater than the number of visible tabs. -
isSelected
Checks if the tab with the given label is currently selected.
Parameters:
label
- the tab labelReturns:
true if the tab is selected, false otherwise.
-
isSelected
public boolean isSelected(int index) Checks if the visible tab at the given index is currently selected.
The
index
refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to check if tab 'C' is selected, the call must beisSelected(1)
and notisSelected(2)
.Parameters:
index
- the zero-based index of the tabReturns:
true if the tab is selected, false otherwise.
Throws:
IllegalStateException
- if tab at given index is not visible in the browserIllegalArgumentException
- if theindex
is less than zero or greater than the number of visible tabs. -
getTab
Gets the visible tab with the given label.
Parameters:
label
- the tab labelThrows:
IllegalStateException
- if tab is not visible -
getTab
Gets the visible tab at given index.
The
index
refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to get tab 'C', the call must begetTab(1)
and notgetTab(2)
.Parameters:
index
- the zero-based index of the selected tab, negative value to unselectThrows:
IllegalStateException
- if tab at given index is not visible in the browserIllegalArgumentException
- if theindex
is less than zero or greater than the number of visible tabs.
-