diff options
author | Henrik Paul <henrik@vaadin.com> | 2014-12-19 11:43:04 +0200 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2014-12-19 12:35:13 +0200 |
commit | 0d38ae887ce30b29ba605aba9c597daf39175f0d (patch) | |
tree | 1cba21b685903975fe159605a554315ffad73531 | |
parent | c1c3564717388708e34f7ec6e9beeb09e4c2d6a4 (diff) | |
download | vaadin-framework-0d38ae887ce30b29ba605aba9c597daf39175f0d.tar.gz vaadin-framework-0d38ae887ce30b29ba605aba9c597daf39175f0d.zip |
Grid no longer resets scrollpos on state change (#15422)
Change-Id: I3fde618a47ad9bb0f8b79c52feb10dd74a387203
3 files changed, 16 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java b/client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java index 96ebd811fb..883bbae0bd 100644 --- a/client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java +++ b/client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java @@ -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) { diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java index 26d6fefa45..91dff944cb 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java @@ -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) { diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java index 9e1a9d5e91..9a9f85ccb9 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java @@ -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()); + } } |