Search in sources :

Example 16 with FlexLayout

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

the class FlexLayoutTest method testFlexLayout_setFlexShrink.

@Test
public void testFlexLayout_setFlexShrink() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    layout.setFlexShrink(2, div);
    Assert.assertEquals("should set flex-shrink", layout.getFlexShrink(div), 2, 0);
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Test(org.junit.Test)

Example 17 with FlexLayout

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

the class FlexLayoutTest method testFlexLayout_setAndUnsetFlexDirection.

@Test
public void testFlexLayout_setAndUnsetFlexDirection() {
    FlexLayout layout = new FlexLayout();
    FlexLayout.FlexDirection direction = FlexLayout.FlexDirection.ROW_REVERSE;
    layout.setFlexDirection(direction);
    Assert.assertEquals("should set flex-direction", layout.getFlexDirection(layout), direction);
    layout.setFlexDirection(null);
    Assert.assertEquals("should return row if no flex-direction set", layout.getFlexDirection(layout), FlexLayout.FlexDirection.ROW);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Test(org.junit.Test)

Example 18 with FlexLayout

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

the class FlexLayoutTest method testFlexLayout_setFlexShrink_throwExceptionIfNegative.

@Test(expected = IllegalArgumentException.class)
public void testFlexLayout_setFlexShrink_throwExceptionIfNegative() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    layout.setFlexShrink(-1, div);
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Test(org.junit.Test)

Example 19 with FlexLayout

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

the class FlexLayoutTest method testFlexLayout_setAndRemoveFlexBasis.

@Test
public void testFlexLayout_setAndRemoveFlexBasis() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    layout.setFlexBasis("10px", div);
    Assert.assertEquals("should set flex-basis", layout.getFlexBasis(div), "10px");
    layout.setFlexBasis(null, div);
    Assert.assertNull("should remove flex-basis from component", layout.getFlexBasis(div));
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Test(org.junit.Test)

Example 20 with FlexLayout

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

the class FlexLayoutTest method testFlexLayout_getFlexShrink_returnOneIfNotSet.

@Test
public void testFlexLayout_getFlexShrink_returnOneIfNotSet() {
    FlexLayout layout = new FlexLayout();
    Div div = new Div();
    layout.add(div);
    Assert.assertEquals("should return 1 if flex-shirk not set", layout.getFlexShrink(div), 1, 0);
}
Also used : Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) 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