Class VirtualListTester

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final T component
    • Constructor Summary

      Constructors 
      Constructor Description
      VirtualListTester(T component) Wrap given component for testing.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      int size() Get the amount of items in the virtual list.
      Y getItem(int index) Get the item at the given index.
      String getItemText(int index) Get the text that is shown on the client for the item at index.
      Component getItemComponent(int index) Get an initialized copy of the component for the item.
      <V> V getLitRendererPropertyValue(int index, String propertyName, Class<V> propertyClass) Get property value for item's LitRenderer.
      void invokeLitRendererFunction(int index, String functionName, JsonArray jsonArray) Invoke named function for item's LitRenderer using the supplied JSON arguments.
      void invokeLitRendererFunction(int index, String functionName) Invoke named function for item's LitRenderer.
      • Methods inherited from class com.vaadin.testbench.unit.ComponentTester

        find, getComponent, isUsable, setModal
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VirtualListTester

        VirtualListTester(T component)
        Wrap given component for testing.
        Parameters:
        component - target component
    • Method Detail

      • size

         int size()

        Get the amount of items in the virtual list.

        Returns:

        number of items in the virtual list

      • getItem

         Y getItem(int index)

        Get the item at the given index.

        Parameters:
        index - the zero-based index of the item to get
        Returns:

        virtual list item at index

      • getItemText

         String getItemText(int index)

        Get the text that is shown on the client for the item at index.

        The index is zero-based. For the default renderer ColumnPathRenderer the result is the sent text for defined object path. For a ComponentRenderer the result is the rendered component as prettyString. More to be added as we find other renderers that need handling.
        Parameters:
        index - the zero-based index of the item
        Returns:

        item content that is sent to the client

      • getItemComponent

         Component getItemComponent(int index)

        Get an initialized copy of the component for the item.

        Note, this is not the actual component.

        Parameters:
        index - the zero-based index of the item
        Returns:

        initialized component for the target item

      • getLitRendererPropertyValue

         <V> V getLitRendererPropertyValue(int index, String propertyName, Class<V> propertyClass)

        Get property value for item's LitRenderer.

        Parameters:
        index - the zero-based index of the item
        propertyName - the name of the LitRenderer property
        propertyClass - the class of the value of the LitRenderer property
        Returns:

        value of the LitRenderer property

      • invokeLitRendererFunction

         void invokeLitRendererFunction(int index, String functionName, JsonArray jsonArray)

        Invoke named function for item's LitRenderer using the supplied JSON arguments.

        Parameters:
        index - the zero-based index of the item
        functionName - the name of the LitRenderer function to invoke
        jsonArray - the arguments to pass to the function
      • invokeLitRendererFunction

         void invokeLitRendererFunction(int index, String functionName)

        Invoke named function for item's LitRenderer.

        Parameters:
        index - the zero-based index of the item
        functionName - the name of the LitRenderer function to invoke