]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix indexing issue in Compatibility Grid resize when scrolled to bottom. (#12003) pr12027/r4
authorAnna Koskinen <Ansku@users.noreply.github.com>
Wed, 13 May 2020 15:44:33 +0000 (18:44 +0300)
committerGitHub <noreply@github.com>
Wed, 13 May 2020 15:44:33 +0000 (18:44 +0300)
Issue #11893, cherry-pick from #11984

compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java
uitest/src/main/java/com/vaadin/tests/components/grid/CompatibilityGridScrollDownResize.java [new file with mode: 0644]

index 3aafe416fc36d40970451438996c12108681f15e..6af497efb3d027ed223816873320e28016960006 100755 (executable)
@@ -3720,6 +3720,7 @@ public class Escalator extends Widget
                                 visualRowOrder.getLast()) + 1;
                         moveAndUpdateEscalatorRows(Range.withOnly(0),
                                 visualRowOrder.size(), newLogicalIndex);
+                        updateTopRowLogicalIndex(1);
                     }
                 }
             }
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/CompatibilityGridScrollDownResize.java b/uitest/src/main/java/com/vaadin/tests/components/grid/CompatibilityGridScrollDownResize.java
new file mode 100644 (file)
index 0000000..973598f
--- /dev/null
@@ -0,0 +1,34 @@
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.minitutorials.v7_4.GridExampleHelper;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.v7.ui.Grid;
+
+public class CompatibilityGridScrollDownResize extends AbstractTestUI {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        // container with at least 100 rows
+        final Grid grid = new Grid(GridExampleHelper.createContainer());
+        grid.setSizeFull();
+        addComponent(grid);
+        getLayout().setSizeFull();
+        getLayout().setExpandRatio(grid, 2);
+        ((VerticalLayout) getLayout().getParent()).setSizeFull();
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11893;
+    };
+
+    @Override
+    protected String getTestDescription() {
+        return "Scrolling all the way down, resizing the browser window smaller "
+                + "so that one row gets completely hidden, and scrolling down "
+                + "again should keep the row contents consistent and in expected "
+                + "sequence.";
+    }
+}