Search in sources :

Example 21 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class FlexLayoutTest method testFlexLayout_setAndUnsetOrder.

@Test
public void testFlexLayout_setAndUnsetOrder() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    Assert.assertEquals("should return 0 if no order set", layout.getOrder(div), 0);
    layout.setOrder(1, div);
    Assert.assertEquals("should set order", layout.getOrder(div), 1);
    layout.setOrder(0, div);
    Assert.assertEquals("should unset order", layout.getOrder(div), 0);
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Test(org.junit.Test)

Example 22 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class FlexLayoutTest method replace_keepAlignmentSelf.

@Test
public void replace_keepAlignmentSelf() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    layout.setAlignSelf(Alignment.END, div);
    Label label = new Label();
    layout.replace(div, label);
    Assert.assertEquals(Alignment.END, layout.getAlignSelf(label));
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Label(com.vaadin.flow.component.html.Label) Test(org.junit.Test)

Example 23 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class FlexLayoutTest method testFlexLayout_setAndUnsetAlignContent.

@Test
public void testFlexLayout_setAndUnsetAlignContent() {
    FlexLayout layout = new FlexLayout();
    FlexLayout.ContentAlignment contentAlignment = FlexLayout.ContentAlignment.CENTER;
    layout.setAlignContent(contentAlignment);
    Assert.assertEquals("should set align-content", layout.getAlignContent(), contentAlignment);
    layout.setAlignContent(null);
    Assert.assertEquals("should return stretch if no align-content set", layout.getAlignContent(), FlexLayout.ContentAlignment.STRETCH);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Test(org.junit.Test)

Example 24 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class LayoutDefaultsTest method create_Layout.

@Test
public void create_Layout() {
    // Just testing that creating layout actually compiles and doesn't
    // throw. Test is on purpose, so that the implementation not
    // accidentally removed.
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.addClickListener(event -> {
    });
    FlexLayout flexLayout = new FlexLayout();
    flexLayout.addClickListener(event -> {
    });
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.addClickListener(event -> {
    });
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) Test(org.junit.Test)

Example 25 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class FlexLayoutTest method replace_keepFlexGrow.

@Test
public void replace_keepFlexGrow() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    layout.setFlexGrow(1.1d, div);
    Label label = new Label();
    layout.replace(div, label);
    Assert.assertEquals(1.1d, layout.getFlexGrow(label), Double.MIN_VALUE);
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Label(com.vaadin.flow.component.html.Label) Test(org.junit.Test)

Aggregations

FlexLayout (com.vaadin.flow.component.orderedlayout.FlexLayout)25 Div (com.vaadin.flow.component.html.Div)14 Test (org.junit.Test)12 Component (com.vaadin.flow.component.Component)10 FlexComponent (com.vaadin.flow.component.orderedlayout.FlexComponent)7 Label (com.vaadin.flow.component.html.Label)4 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)4 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)4 Route (com.vaadin.flow.router.Route)4 H2 (com.vaadin.flow.component.html.H2)3 Span (com.vaadin.flow.component.html.Span)3 RadioButtonGroup (com.vaadin.flow.component.radiobutton.RadioButtonGroup)3 Button (com.vaadin.flow.component.button.Button)2 ComboBox (com.vaadin.flow.component.combobox.ComboBox)2 Image (com.vaadin.flow.component.html.Image)2 List (java.util.List)2 ClickEvent (com.vaadin.flow.component.ClickEvent)1 Key (com.vaadin.flow.component.Key)1 UI (com.vaadin.flow.component.UI)1 LUMO_TERTIARY (com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY)1