diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2017-04-11 09:50:26 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2017-04-11 08:50:26 +0200 |
commit | 4784e342eb7369909085db54ae2efb7a99daf7a3 (patch) | |
tree | 7e822f29c528d8a7a1c25bc82cb6a405fe283ffb /uitest | |
parent | cf7edf7a56d71e39f59984234ea7ffa51db2c696 (diff) | |
download | vaadin-framework-4784e342eb7369909085db54ae2efb7a99daf7a3.tar.gz vaadin-framework-4784e342eb7369909085db54ae2efb7a99daf7a3.zip |
Fix initial expand of TreeGrid items
Fixes #9050
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpand.java | 28 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpandTest.java | 23 |
2 files changed, 51 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpand.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpand.java new file mode 100644 index 0000000000..db5b8c54b6 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpand.java @@ -0,0 +1,28 @@ +package com.vaadin.tests.components.treegrid; + +import com.vaadin.data.HierarchyData; +import com.vaadin.data.provider.InMemoryHierarchicalDataProvider; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.TreeGrid; + +public class TreeGridInitialExpand extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + TreeGrid<String> treeGrid = new TreeGrid<>(); + treeGrid.setCaption("Test"); + treeGrid.addColumn(String::toString).setCaption("String"); + HierarchyData<String> data = new HierarchyData<>(); + data.addItem(null, "parent1"); + data.addItem("parent1", "parent1-child1"); + data.addItem("parent1", "parent1-child2"); + data.addItem(null, "parent2"); + data.addItem("parent2", "parent2-child2"); + treeGrid.setDataProvider(new InMemoryHierarchicalDataProvider<>(data)); + treeGrid.setHeightByRows(5); + treeGrid.expand("parent1"); + treeGrid.expand("parent2"); + addComponent(treeGrid); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpandTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpandTest.java new file mode 100644 index 0000000000..d82155da6b --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridInitialExpandTest.java @@ -0,0 +1,23 @@ +package com.vaadin.tests.components.treegrid; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.vaadin.testbench.elements.TreeGridElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class TreeGridInitialExpandTest extends SingleBrowserTest { + + @Test + public void initial_expand_of_items() { + openTestURL(); + TreeGridElement grid = $(TreeGridElement.class).first(); + + assertEquals("parent1", grid.getCell(0, 0).getText()); + assertEquals("parent1-child1", grid.getCell(1, 0).getText()); + assertEquals("parent1-child2", grid.getCell(2, 0).getText()); + assertEquals("parent2", grid.getCell(3, 0).getText()); + assertEquals("parent2-child2", grid.getCell(4, 0).getText()); + } +} |