diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-06-15 15:44:56 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2017-06-15 15:44:56 +0300 |
commit | f76cc830efa7f4823e8eed272de8b5ca2cfebfc3 (patch) | |
tree | ab13cc3048b193e24516eaff8c3d7d5755f78334 /uitest | |
parent | ca437c758b0bffb7760d93d64021fbb2917a35fd (diff) | |
download | vaadin-framework-f76cc830efa7f4823e8eed272de8b5ca2cfebfc3.tar.gz vaadin-framework-f76cc830efa7f4823e8eed272de8b5ca2cfebfc3.zip |
Rewrite HierarchyMapper to consistently handle changes
Fixes #9449
Fixes #9490
Fixes #9448
Fixes #9465
Diffstat (limited to 'uitest')
2 files changed, 14 insertions, 9 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchy.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchy.java index d630e36292..53d1cb98e7 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchy.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchy.java @@ -14,8 +14,7 @@ import com.vaadin.ui.TreeGrid; public class TreeGridChangingHierarchy extends AbstractTestUI { - private static class TestDataProvider - extends TreeDataProvider<String> { + private static class TestDataProvider extends TreeDataProvider<String> { private TreeData<String> treeData; @@ -64,24 +63,34 @@ public class TreeGridChangingHierarchy extends AbstractTestUI { Button btn3 = new Button("remove a/a"); btn3.addClickListener(event -> { data.removeItem("a/a"); + // Inform item removal to DataProvider + grid.getDataProvider().refreshAll(); }); Button btn4 = new Button("remove children of a/a"); btn4.addClickListener(event -> { data.removeItem("a/a/a"); data.removeItem("a/a/c"); + // Inform item removal to DataProvider + grid.getDataProvider().refreshAll(); }); Button btn5 = new Button("remove a"); btn5.addClickListener(event -> { data.removeItem("a"); + // Inform item removal to DataProvider + grid.getDataProvider().refreshAll(); }); Button btn6 = new Button("remove children of a"); btn6.addClickListener(event -> { data.removeItem("a/a"); data.removeItem("a/b"); + // Inform item removal to DataProvider + grid.getDataProvider().refreshAll(); }); Button btn7 = new Button("remove children of a/a/a"); btn7.addClickListener(event -> { data.removeItem("a/a/a/a"); + // Inform item removal to DataProvider + grid.getDataProvider().refreshAll(); }); addComponents(grid, btn, btn2, btn3, btn4, btn5, btn6, btn7); diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchyTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchyTest.java index 89273af661..eaac894523 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchyTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridChangingHierarchyTest.java @@ -52,9 +52,6 @@ public class TreeGridChangingHierarchyTest extends SingleBrowserTest { grid.expandWithClick(1); grid.collapseWithClick(0); removeAABtn.click(); - // Item removed from hierarchy. when encountering less children than - // expected, should reset: - grid.expandWithClick(0); // expand "a" after the reset: grid.expandWithClick(0); // "a/a" should be removed from a's children: @@ -92,9 +89,6 @@ public class TreeGridChangingHierarchyTest extends SingleBrowserTest { grid.expandWithClick(2); removeChildrenOfAAABtn.click(); grid.collapseWithClick(1); - // reset should get triggered here - grid.expandWithClick(1); - grid.expandWithClick(0); grid.expandWithClick(1); assertEquals("a/a/a", grid.getCell(2, 0).getText()); assertFalse(grid.hasExpandToggle(2, 0)); @@ -106,7 +100,9 @@ public class TreeGridChangingHierarchyTest extends SingleBrowserTest { grid.expandWithClick(0); grid.getCell(1, 0).click(); removeChildrenOfABtn.click(); - grid.collapseWithClick(0); + // HierarchyMapper will notice the removal of the children of a, and + // mark it as collapsed. + // grid.collapseWithClick(0); grid.getCell(1, 0).click(); assertTrue(grid.getRow(1).isSelected()); } |