Class DashboardTester

  • All Implemented Interfaces:
    com.vaadin.browserless.Clickable

    
    public class DashboardTester<T extends Dashboard>
    extends ComponentTester<T>
                        

    Tester for the Dashboard component.

    Simulates the interactions a user performs on an editable dashboard: reordering, resizing and removing widgets. Each method fires the same client-side event the web component sends, so the dashboard updates its server-side model and notifies any registered listeners exactly as it would in a browser. All three actions require the dashboard to be editable (setEditable), mirroring the component: a user cannot move, resize or remove widgets otherwise.

    Since:

    1.1

    • 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
      DashboardTester(T component) Wrap given component for testing.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void moveWidget(DashboardWidget widget, int toIndex) Simulates a user dragging the given widget to a new position within its current container (the dashboard root, or the section it belongs to).
      void resizeWidget(DashboardWidget widget, int colspan, int rowspan) Simulates a user resizing the given widget to the given column and row span.
      void removeWidget(DashboardWidget widget) Simulates a user removing the given widget by clicking its remove button.
      • Methods inherited from class com.vaadin.browserless.ComponentTester

        ensureComponentIsUsable, find, getComponent, isUsable, setModal
      • 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

      • DashboardTester

        DashboardTester(T component)

        Wrap given component for testing.

        Parameters:
        component - target component
    • Method Detail

      • moveWidget

         void moveWidget(DashboardWidget widget, int toIndex)

        Simulates a user dragging the given widget to a new position within its current container (the dashboard root, or the section it belongs to).

        Parameters:
        widget - the widget to move, not null
        toIndex - the target index among the widget's siblings
      • resizeWidget

         void resizeWidget(DashboardWidget widget, int colspan, int rowspan)

        Simulates a user resizing the given widget to the given column and row span.

        Parameters:
        widget - the widget to resize, not null
        colspan - the new column span
        rowspan - the new row span
      • removeWidget

         void removeWidget(DashboardWidget widget)

        Simulates a user removing the given widget by clicking its remove button.

        If the dashboard has a custom remove handler, it receives the event and decides whether to remove the widget; otherwise the widget is removed immediately.

        Parameters:
        widget - the widget to remove, not null