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