com.vaadin.flow.component.tabs.
Class TabSheetTester<T extends TabSheet>
Type Parameters:
T
- component type
Tester for TabSheet component.
-
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.
<E extends Component>
EgetTabContent
(int index) Gets the content of the visible tab at given index.
<E extends Component>
EgetTabContent
(String label) Gets the content of 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
-
TabSheetTester
Wrap given component for testing.
Parameters:
component
- target component
-
-
Method Details
-
select
Selects the tab with the given label.
Parameters:
label
- the tab labelThrows:
IllegalArgumentException
- if the tab with givenlabel
is not visible.IllegalStateException
- if tab is not usable in the browser -
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 give index is not usable in the browser -
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.
Throws:
IllegalArgumentException
- if the tab with givenlabel
is not visible. -
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 browser -
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 unselectReturns:
the tab at the given index
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. -
getTabContent
Gets the content of the visible tab with the given label.
Parameters:
label
- the tab labelReturns:
the content of the tab with the given label
Throws:
IllegalStateException
- if tab is not visible -
getTabContent
Gets the content of 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 the content of tab 'C', the call must begetTabContent(1)
and notgetTabContent(2)
.Parameters:
index
- the zero-based index of the selected tab, negative value to unselectReturns:
the content of the tab at the given index
Throws:
IllegalStateException
- if tab is not visibleIllegalArgumentException
- if theindex
is less than zero or greater than the number of visible tabs.
-