diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2021-08-20 14:27:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-20 14:27:18 +0300 |
commit | 7c666980c0dabcf6f3dbcd0e395b5cbdec024dc7 (patch) | |
tree | 2fa6a97cc9a49afa67057d1695ca8560fe3ff7f2 /uitest/src | |
parent | 029f47f1faaa9fd421e01b3b7fc664faf0fcae8f (diff) | |
download | vaadin-framework-7c666980c0dabcf6f3dbcd0e395b5cbdec024dc7.tar.gz vaadin-framework-7c666980c0dabcf6f3dbcd0e395b5cbdec024dc7.zip |
Updates to TreeGrid's ensureAvailability handling. (#12374)
- Always update the availability request range when more or less data
becomes available. Otherwise e.g. programmatically expanding a TreeGrid
row can lead to discarding a lot of the new data right after receiving
it.
Fixes #12372
Diffstat (limited to 'uitest/src')
2 files changed, 67 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridProgrammaticExpand.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridProgrammaticExpand.java new file mode 100644 index 0000000000..f6c5a6b8c1 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridProgrammaticExpand.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.components.treegrid; + +import com.vaadin.data.TreeData; +import com.vaadin.data.provider.TreeDataProvider; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.TreeGrid; + +public class TreeGridProgrammaticExpand extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + TreeData<String> data = new TreeData<>(); + String root = "Root"; + data.addItem(null, root); + for (int i = 0; i < 15; i++) { + String leaf = "Leaf " + i; + data.addItem(root, leaf); + } + + TreeDataProvider<String> treeDataProvider = new TreeDataProvider<>( + data); + TreeGrid<String> treeGrid = new TreeGrid<>(); + treeGrid.setDataProvider(treeDataProvider); + treeGrid.addColumn(String::toString).setCaption("String") + .setId("string"); + treeGrid.addColumn(i -> "--").setCaption("Nothing"); + + Button button = new Button("Expand", e -> treeGrid.expand(root)); + + addComponents(button, treeGrid); + } + + @Override + protected String getTestDescription() { + return "There should be no client-side exception when clicking Leaf 4 " + + "or lower before scrolling."; + } + + @Override + protected Integer getTicketNumber() { + return 12372; + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridProgrammaticExpandTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridProgrammaticExpandTest.java new file mode 100644 index 0000000000..65d8f2f680 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridProgrammaticExpandTest.java @@ -0,0 +1,22 @@ +package com.vaadin.tests.components.treegrid; + +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TreeGridElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TreeGridProgrammaticExpandTest extends MultiBrowserTest { + + @Test + public void expandAndClick() { + openTestURL("debug"); + TreeGridElement treeGrid = $(TreeGridElement.class).first(); + $(ButtonElement.class).first().click(); + waitUntilLoadingIndicatorNotVisible(); + treeGrid.getCell(5, 0).click(); + waitUntilLoadingIndicatorNotVisible(); + assertElementNotPresent(By.className("v-Notification-error")); + } +} |