Search in sources :

Example 1 with Tabs

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
}
Also used : Tab(com.vaadin.flow.component.tabs.Tab) Tabs(com.vaadin.flow.component.tabs.Tabs) Test(org.junit.Test)

Example 2 with Tabs

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));
}
Also used : Tab(com.vaadin.flow.component.tabs.Tab) Tabs(com.vaadin.flow.component.tabs.Tabs) Test(org.junit.Test)

Example 3 with Tabs

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));
}
Also used : Tab(com.vaadin.flow.component.tabs.Tab) Tabs(com.vaadin.flow.component.tabs.Tabs) Test(org.junit.Test)

Example 4 with Tabs

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));
}
Also used : Tabs(com.vaadin.flow.component.tabs.Tabs) Test(org.junit.Test)

Example 5 with Tabs

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
}
Also used : Tabs(com.vaadin.flow.component.tabs.Tabs) Test(org.junit.Test)

Aggregations

Tabs (com.vaadin.flow.component.tabs.Tabs)40 Tab (com.vaadin.flow.component.tabs.Tab)17 Test (org.junit.Test)16 Component (com.vaadin.flow.component.Component)5 Div (com.vaadin.flow.component.html.Div)3 FlexComponent (com.vaadin.flow.component.orderedlayout.FlexComponent)2 ShowComponentRequestedEvent (org.archcnl.ui.outputview.sidebar.events.ShowComponentRequestedEvent)2 HasElement (com.vaadin.flow.component.HasElement)1 Text (com.vaadin.flow.component.Text)1 H3 (com.vaadin.flow.component.html.H3)1 NativeButton (com.vaadin.flow.component.html.NativeButton)1 Icon (com.vaadin.flow.component.icon.Icon)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)1 TabsVariant (com.vaadin.flow.component.tabs.TabsVariant)1 Element (com.vaadin.flow.dom.Element)1 FurmsViewComponent (io.imunity.furms.ui.components.FurmsViewComponent)1 LogoutIconFactory (io.imunity.furms.ui.components.LogoutIconFactory)1 MenuComponent (io.imunity.furms.ui.components.MenuComponent)1 TabComponent (io.imunity.furms.ui.components.TabComponent)1