Search in sources :

Example 36 with Tabs

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

Example 37 with Tabs

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

Example 38 with Tabs

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

Example 39 with Tabs

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

Example 40 with Tabs

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