use of com.vaadin.flow.component.splitlayout.SplitLayout in project flow-components by vaadin.
the class SplitLayoutUnitTest method testGetOrientation_nothingSet_defaultReturnsHORIZONTAL.
@Test
public void testGetOrientation_nothingSet_defaultReturnsHORIZONTAL() {
SplitLayout splitLayout = new SplitLayout();
Assert.assertEquals("Invalid default orientation", SplitLayout.Orientation.HORIZONTAL, splitLayout.getOrientation());
}
use of com.vaadin.flow.component.splitlayout.SplitLayout in project flow-components by vaadin.
the class SplitLayoutUnitTest method testAddingSeveralComponents_slotspresent_wrapsInDiv.
@Test
public void testAddingSeveralComponents_slotspresent_wrapsInDiv() {
SplitLayout splitLayout = new SplitLayout();
splitLayout.addToPrimary(new Label("1"), new Label("2"), new Label("3"));
splitLayout.addToSecondary(new Label("4"), new Label("5"));
Component primaryComponent = splitLayout.getPrimaryComponent();
Assert.assertEquals("The slot doesn't contain the primary slot.", "primary", primaryComponent.getElement().getAttribute("slot"));
Assert.assertEquals("No wrapper div", "div", primaryComponent.getElement().getTag());
Assert.assertEquals("Wrong number of children", 3, primaryComponent.getChildren().count());
Component secondaryComponent = splitLayout.getSecondaryComponent();
Assert.assertEquals("The slot doesn't contain the secondary slot.", "secondary", secondaryComponent.getElement().getAttribute("slot"));
Assert.assertEquals("No wrapper div", "div", secondaryComponent.getElement().getTag());
Assert.assertEquals("Wrong number of children", 2, secondaryComponent.getChildren().count());
}
use of com.vaadin.flow.component.splitlayout.SplitLayout in project flow-components by vaadin.
the class SplitLayoutView method addMinMaxWidthLayout.
private void addMinMaxWidthLayout() {
SplitLayout layout = new SplitLayout();
layout.setId("split-layout-min-max");
layout.addToPrimary(new Label("First content component"));
layout.addToSecondary(new Label("Second content component"));
layout.setPrimaryStyle("minWidth", "100px");
layout.setPrimaryStyle("maxWidth", "150px");
layout.setPrimaryStyle("background", "salmon");
layout.getPrimaryComponent().setId("min-max-first-component");
setMinHeightForLayout(layout);
addCard("Split Layout with Minimum and Maximum Widths", layout);
}
Aggregations