]> source.dussan.org Git - vaadin-framework.git/commitdiff
Grid no longer resets scrollpos on state change (#15422)
authorHenrik Paul <henrik@vaadin.com>
Fri, 19 Dec 2014 09:43:04 +0000 (11:43 +0200)
committerHenrik Paul <henrik@vaadin.com>
Fri, 19 Dec 2014 10:35:13 +0000 (12:35 +0200)
Change-Id: I3fde618a47ad9bb0f8b79c52feb10dd74a387203

client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java

index 96ebd811fb174d2393ee17c3c166aab32ad12ba3..883bbae0bdd4a6ac9e5995e67b5e62f3fa3cea46 100644 (file)
@@ -414,7 +414,7 @@ public abstract class ScrollbarBundle implements DeferredWorker {
          * offset size. All other browser need to suffer alongside.
          */
 
-        boolean newOffsetSizeIsGreaterThanScrollSize = px > getOffsetSize();
+        boolean newOffsetSizeIsGreaterThanScrollSize = px > getScrollSize();
         boolean offsetSizeBecomesGreaterThanScrollSize = showsScrollHandle()
                 && newOffsetSizeIsGreaterThanScrollSize;
         if (offsetSizeBecomesGreaterThanScrollSize && getScrollPos() != 0) {
index 26d6fefa453a941692e84336b5dcfa0d8ef25604..91dff944cbcd51ff70f9a512a2c7239bc7acd3e2 100644 (file)
@@ -74,6 +74,11 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
                 getGridVerticalScrollbar());
     }
 
+    protected int getGridVerticalScrollPos() {
+        return ((Number) executeScript("return arguments[0].scrollTop",
+                getGridVerticalScrollbar())).intValue();
+    }
+
     protected List<TestBenchElement> getGridHeaderRowCells() {
         List<TestBenchElement> headerCells = new ArrayList<TestBenchElement>();
         for (int i = 0; i < getGridElement().getHeaderCount(); ++i) {
index 9e1a9d5e91421d08536498beac9324c1b916e24d..9a9f85ccb94d6c1ca1826df80a6aca7e4e4b24eb 100644 (file)
@@ -437,4 +437,14 @@ public class GridStructureTest extends GridBasicFeaturesTest {
         assertTrue(vscrollStyleName.contains(stylename + "-scroller"));
         assertTrue(vscrollStyleName.contains(stylename + "-scroller-vertical"));
     }
+
+    @Test
+    public void testScrollPosDoesNotChangeAfterStateChange() {
+        openTestURL();
+        scrollGridVerticallyTo(1000);
+        int scrollPos = getGridVerticalScrollPos();
+        selectMenuPath("Component", "Editor", "Enabled");
+        assertEquals("Scroll position should've not have changed", scrollPos,
+                getGridVerticalScrollPos());
+    }
 }