aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2015-01-28 15:50:54 +0200
committerLeif Ã…strand <leif@vaadin.com>2015-03-02 14:36:51 +0200
commitfa8174a94616d3d0f76ec41dbac389269e1fcb59 (patch)
treee2364116138a1a2d815548aa64c8b051181ac551 /uitest/src/com
parent78c74afb22c935a7bbbee82253206ea572ebd474 (diff)
downloadvaadin-framework-fa8174a94616d3d0f76ec41dbac389269e1fcb59.tar.gz
vaadin-framework-fa8174a94616d3d0f76ec41dbac389269e1fcb59.zip
Maintain Grid scroll position on detach and reattach (#16220)
Change-Id: I6ac5c3304bcd22e23f298c4dbdd65358aa1c64f7
Diffstat (limited to 'uitest/src/com')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeaturesTest.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorBasicsTest.java34
2 files changed, 30 insertions, 11 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeaturesTest.java
index 92c7f3e6a6..a4fa55441a 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeaturesTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeaturesTest.java
@@ -52,6 +52,7 @@ public abstract class EscalatorBasicClientFeaturesTest extends MultiBrowserTest
protected static final String GENERAL = "General";
protected static final String DETACH_ESCALATOR = "Detach Escalator";
+ protected static final String ATTACH_ESCALATOR = "Attach Escalator";
protected static final String POPULATE_COLUMN_ROW = "Populate Escalator (columns, then rows)";
protected static final String POPULATE_ROW_COLUMN = "Populate Escalator (rows, then columns)";
protected static final String CLEAR_COLUMN_ROW = "Clear (columns, then rows)";
@@ -234,10 +235,10 @@ public abstract class EscalatorBasicClientFeaturesTest extends MultiBrowserTest
}
protected void scrollVerticallyTo(int px) {
- executeScript("arguments[0].scrollTop = " + px, getVeticalScrollbar());
+ executeScript("arguments[0].scrollTop = " + px, getVerticalScrollbar());
}
- private TestBenchElement getVeticalScrollbar() {
+ protected TestBenchElement getVerticalScrollbar() {
return (TestBenchElement) getEscalator().findElement(
By.className("v-escalator-scroller-vertical"));
}
@@ -247,7 +248,7 @@ public abstract class EscalatorBasicClientFeaturesTest extends MultiBrowserTest
getHorizontalScrollbar());
}
- private TestBenchElement getHorizontalScrollbar() {
+ protected TestBenchElement getHorizontalScrollbar() {
return (TestBenchElement) getEscalator().findElement(
By.className("v-escalator-scroller-horizontal"));
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorBasicsTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorBasicsTest.java
index 95ed6ab3ff..4742236ac6 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorBasicsTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorBasicsTest.java
@@ -15,11 +15,13 @@
*/
package com.vaadin.tests.components.grid.basicfeatures.escalator;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import java.io.IOException;
+import org.junit.Before;
import org.junit.Test;
import com.vaadin.testbench.elements.NotificationElement;
@@ -27,20 +29,20 @@ import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeatur
public class EscalatorBasicsTest extends EscalatorBasicClientFeaturesTest {
- @Test
- public void testDetachingAnEmptyEscalator() {
+ @Before
+ public void setUp() {
setDebug(true);
openTestURL();
+ }
+ @Test
+ public void testDetachingAnEmptyEscalator() {
selectMenuPath(GENERAL, DETACH_ESCALATOR);
assertEscalatorIsRemovedCorrectly();
}
@Test
public void testDetachingASemiPopulatedEscalator() throws IOException {
- setDebug(true);
- openTestURL();
-
selectMenuPath(COLUMNS_AND_ROWS, ADD_ONE_OF_EACH_ROW);
selectMenuPath(COLUMNS_AND_ROWS, COLUMNS, ADD_ONE_COLUMN_TO_BEGINNING);
selectMenuPath(GENERAL, DETACH_ESCALATOR);
@@ -49,14 +51,30 @@ public class EscalatorBasicsTest extends EscalatorBasicClientFeaturesTest {
@Test
public void testDetachingAPopulatedEscalator() {
- setDebug(true);
- openTestURL();
-
selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
selectMenuPath(GENERAL, DETACH_ESCALATOR);
assertEscalatorIsRemovedCorrectly();
}
+ @Test
+ public void testDetachingAndReattachingAnEscalator() {
+ selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
+
+ scrollVerticallyTo(50);
+ scrollHorizontallyTo(50);
+
+ selectMenuPath(GENERAL, DETACH_ESCALATOR);
+ selectMenuPath(GENERAL, ATTACH_ESCALATOR);
+
+ assertEquals("Vertical scroll position", "50", getVerticalScrollbar()
+ .getAttribute("scrollTop"));
+ assertEquals("Horizontal scroll position", "50",
+ getHorizontalScrollbar().getAttribute("scrollLeft"));
+
+ assertEquals("First cell of first visible row", "Row 2: 0,2",
+ getBodyCell(0, 0).getText());
+ }
+
private void assertEscalatorIsRemovedCorrectly() {
assertFalse($(NotificationElement.class).exists());
assertNull(getEscalator());