Class SideNavTester
-
- All Implemented Interfaces:
public class SideNavTester<T extends SideNav> extends ComponentTester<T>
-
-
Constructor Summary
Constructors Constructor Description SideNavTester(T component)Wrap given component for testing.
-
Method Summary
Modifier and Type Method Description voidclickItem(String topLevelLabel, Array<String> nestedItemLabels)Simulates a click on the item that matches the given label. voidexpandAndClickItem(String topLevelLabel, Array<String> nestedItemLabels)Simulates a click on the item that matches the given label, expanding potential parent collapsed nodes. voidclick()Simulates a click on the SideNav label, expanding or collapsing item list. voidtoggleItem(String topLevelLabel, Array<String> nestedItemLabels)Simulates a click on the item that matches the given label. voidtoggle()Simulates a click on the SideNav toggle button, expanding or collapsing item list. -
-
Constructor Detail
-
SideNavTester
SideNavTester(T component)
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Detail
-
clickItem
void clickItem(String topLevelLabel, Array<String> nestedItemLabels)
Simulates a click on the item that matches the given label. For nested navigation item provide the label of each item in the hierarchy. The path to the navigation item must reflect what is seen in the browser, meaning that hidden items are ignored. For the same reason, items inside collapsed nodes cannot be clicked and an exception is thrown. Use expandAndClickItem to expand intermediate node and click on the desired item.
sideNav.addItem(new SideNavItem("Home", HomeView.class)); SideNavItem childNav = new SideNavItem("Messages"); childNav.addItem(new SideNavItem("Inbox", InboxView.class)); childNav.addItem(new SideNavItem("Sent", SentView.class)); sideNav.addItem(childNav); // clicks top level navigation item with label Home tester.clickItem("Home"); // clicks nested navigation item with label Sent wrapper.clickItem("Messages", "Sent");- Parameters:
topLevelLabel- the text content of the top level SideNav item label, not null.nestedItemLabels- labels of the nested SideNav items
-
expandAndClickItem
void expandAndClickItem(String topLevelLabel, Array<String> nestedItemLabels)
Simulates a click on the item that matches the given label, expanding potential parent collapsed nodes. For nested navigation item provide the label of each item in the hierarchy. The path to the navigation item must reflect what is seen in the browser, meaning that hidden items are ignored. For the same reason, items inside collapsed nodes cannot be clicked and an exception is thrown.
sideNav.addItem(new SideNavItem("Home", HomeView.class)); SideNavItem childNav = new SideNavItem("Messages"); childNav.addItem(new SideNavItem("Inbox", InboxView.class)); childNav.addItem(new SideNavItem("Sent", SentView.class)); sideNav.addItem(childNav); // clicks nested navigation item with label Sent wrapper.expandAndClickItem("Messages", "Sent");- Parameters:
topLevelLabel- the text content of the top level SideNav item label, not null.nestedItemLabels- labels of the nested SideNav items
-
click
void click()
Simulates a click on the SideNav label, expanding or collapsing item list.
-
toggleItem
void toggleItem(String topLevelLabel, Array<String> nestedItemLabels)
Simulates a click on the item that matches the given label. For nested navigation item provide the label of each item in the hierarchy. The path to the navigation item must reflect what is seen in the browser, meaning that hidden items are ignored. For the same reason, items inside collapsed nodes cannot be clicked and an exception is thrown. Use expandAndClickItem to expand intermediate node and click on the desired item.
sideNav.addItem(new SideNavItem("Home", HomeView.class)); SideNavItem childNav = new SideNavItem("Messages"); childNav.addItem(new SideNavItem("Inbox", InboxView.class)); childNav.addItem(new SideNavItem("Sent", SentView.class)); sideNav.addItem(childNav); // clicks top level navigation item with label Home tester.clickItem("Home"); // clicks nested navigation item with label Sent wrapper.clickItem("Messages", "Sent");- Parameters:
topLevelLabel- the text content of the top level SideNav item label, not null.nestedItemLabels- labels of the nested SideNav items
-
toggle
void toggle()
Simulates a click on the SideNav toggle button, expanding or collapsing item list.
-
-
-
-