com.vaadin.flow.component.tabs.

Class TabSheetTester<T extends TabSheet>

java.lang.Object
com.vaadin.testbench.unit.ComponentTester<T>
com.vaadin.flow.component.tabs.TabSheetTester<T>

Type Parameters:

T - component type

public class TabSheetTester<T extends TabSheet> extends ComponentTester<T>

Tester for TabSheet component.

  • Constructor Details

    • TabSheetTester

      public TabSheetTester(T component)

      Wrap given component for testing.

      Parameters:

      component - target component

  • Method Details

    • select

      public void select(String label)

      Selects the tab with the given label.

      Parameters:

      label - the tab label

      Throws:

      IllegalArgumentException - if the tab with given label 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 be select(1) and not select(2).

      Parameters:

      index - the zero-based index of the selected tab, negative value to unselect

      Throws:

      IllegalStateException - if tab at give index is not usable in the browser

    • isSelected

      public boolean isSelected(String label)

      Checks if the tab with the given label is currently selected.

      Parameters:

      label - the tab label

      Returns:

      true if the tab is selected, false otherwise.

      Throws:

      IllegalArgumentException - if the tab with given label 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 be isSelected(1) and not isSelected(2).

      Parameters:

      index - the zero-based index of the tab

      Returns:

      true if the tab is selected, false otherwise.

      Throws:

      IllegalStateException - if tab at given index is not visible in the browser

    • getTab

      public Tab getTab(String label)

      Gets the visible tab with the given label.

      Parameters:

      label - the tab label

      Throws:

      IllegalStateException - if tab is not visible

    • getTab

      public Tab getTab(int index)

      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 be getTab(1) and not getTab(2).

      Parameters:

      index - the zero-based index of the selected tab, negative value to unselect

      Returns:

      the tab at the given index

      Throws:

      IllegalStateException - if tab at given index is not visible in the browser

      IllegalArgumentException - if the index is less than zero or greater than the number of visible tabs.

    • getTabContent

      public <E extends Component> E getTabContent(String label)

      Gets the content of the visible tab with the given label.

      Parameters:

      label - the tab label

      Returns:

      the content of the tab with the given label

      Throws:

      IllegalStateException - if tab is not visible

    • getTabContent

      public <E extends Component> E getTabContent(int index)

      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 be getTabContent(1) and not getTabContent(2).

      Parameters:

      index - the zero-based index of the selected tab, negative value to unselect

      Returns:

      the content of the tab at the given index

      Throws:

      IllegalStateException - if tab is not visible

      IllegalArgumentException - if the index is less than zero or greater than the number of visible tabs.