use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method selectTab_tabIsSelected.
@Test
public void selectTab_tabIsSelected() {
Tabs tabs = new Tabs();
Tab tab1 = new Tab("foo");
Tab tab2 = new Tab("foo");
tabs.add(tab1, tab2);
tabs.setSelectedTab(tab2);
Assert.assertFalse(tab1.isSelected());
Assert.assertTrue(tab2.isSelected());
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method createTabsInDefaultState.
@Test
public void createTabsInDefaultState() {
Tabs tabs = new Tabs();
assertThat("Initial child count is invalid", tabs.getComponentCount(), is(0));
assertThat("Initial orientation is invalid", tabs.getOrientation(), is(Tabs.Orientation.HORIZONTAL));
assertThat("Initial selected index is invalid", tabs.getSelectedIndex(), is(-1));
assertThat("Initial child count is invalid", tabs.getSelectedTab(), CoreMatchers.nullValue());
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method tabsWithoutAutomaticSelection.
@Test
public void tabsWithoutAutomaticSelection() {
Tab tab1 = new Tab("Tab one");
Tab tab2 = new Tab("Tab two");
Tabs tabs2 = new Tabs(false, tab1, tab2);
Assert.assertNull(tabs2.getSelectedTab());
Assert.assertEquals(tabs2.getSelectedIndex(), -1);
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method createTabsWithChildren.
@Test
public void createTabsWithChildren() {
Tab tab1 = new Tab("Tab one");
Tab tab2 = new Tab("Tab two");
Tab tab3 = new Tab("Tab three");
Tabs tabs = new Tabs(tab1, tab2, tab3);
assertThat("Initial child count is invalid", tabs.getComponentCount(), is(3));
assertThat("Initial orientation is invalid", tabs.getOrientation(), is(Tabs.Orientation.HORIZONTAL));
assertThat("Initial selected tab is invalid", tabs.getSelectedTab(), is(tab1));
assertThat("Initial selected index is invalid", tabs.getSelectedIndex(), is(0));
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method selectTabByReference.
@Test
public void selectTabByReference() {
Tab tab1 = new Tab("Tab one");
Tab tab2 = new Tab("Tab two");
Tab tab3 = new Tab("Tab three");
Tabs tabs = new Tabs(tab1, tab2, tab3);
tabs.setSelectedTab(tab2);
assertThat("Selected tab is invalid", tabs.getSelectedTab(), is(tab2));
assertThat("Selected index is invalid", tabs.getSelectedIndex(), is(1));
}
Aggregations