From 0d38ae887ce30b29ba605aba9c597daf39175f0d Mon Sep 17 00:00:00 2001 From: Henrik Paul Date: Fri, 19 Dec 2014 11:43:04 +0200 Subject: Grid no longer resets scrollpos on state change (#15422) Change-Id: I3fde618a47ad9bb0f8b79c52feb10dd74a387203 --- .../components/grid/basicfeatures/GridBasicFeaturesTest.java | 5 +++++ .../grid/basicfeatures/server/GridStructureTest.java | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'uitest') 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 getGridHeaderRowCells() { List headerCells = new ArrayList(); 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()); + } } -- cgit v1.2.3