use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method shouldThrowWhenTabToSelectIsNotChild.
@Test
public void shouldThrowWhenTabToSelectIsNotChild() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Tab to select must be a child: Tab{orphan}");
Tab tab1 = new Tab("Tab one");
Tab tab2 = new Tab("Tab two");
Tab tab3 = new Tab("orphan");
Tabs tabs = new Tabs(tab1, tab2);
tabs.setSelectedTab(tab3);
// Exception expected - nothing to assert
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method selectTabByIndex.
@Test
public void selectTabByIndex() {
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.setSelectedIndex(2);
assertThat("Selected tab is invalid", tabs.getSelectedTab(), is(tab3));
assertThat("Selected index is invalid", tabs.getSelectedIndex(), is(2));
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method setFlexGrowForEnclosedTabs.
@Test
public void setFlexGrowForEnclosedTabs() {
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.setFlexGrowForEnclosedTabs(1.5);
assertThat("flexGrow of tab1 is invalid", tab1.getFlexGrow(), is(1.5));
assertThat("flexGrow of tab2 is invalid", tab2.getFlexGrow(), is(1.5));
assertThat("flexGrow of tab3 is invalid", tab3.getFlexGrow(), is(1.5));
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method setOrientation.
@Test
public void setOrientation() {
Tabs tabs = new Tabs();
tabs.setOrientation(Tabs.Orientation.VERTICAL);
assertThat("Orientation is invalid", tabs.getOrientation(), is(Tabs.Orientation.VERTICAL));
}
use of com.vaadin.flow.component.tabs.Tabs in project flow-components by vaadin.
the class TabsTest method shouldThrowOnNegativeFlexGrow.
@Test
public void shouldThrowOnNegativeFlexGrow() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Flex grow property must not be negative");
Tabs tabs = new Tabs();
tabs.setFlexGrowForEnclosedTabs(-1);
// Exception expected - nothing to assert
}
Aggregations