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);
}
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);
}
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);
}
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));
}
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);
}
Aggregations