]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix Escalator size changes when scrolled to bottom (#16382)
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 24 Feb 2015 11:43:01 +0000 (13:43 +0200)
committerLeif Åstrand <leif@vaadin.com>
Wed, 25 Feb 2015 11:04:42 +0000 (13:04 +0200)
Change-Id: Iaf8b21e9c6a09e51667eebae1fdd4b1f5ebabedd

client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java [new file with mode: 0644]

index e4924e9509bd76c11b0ea2820df58aebd3f53dbc..21f56c6c4d82c4c3605b279fcecbafa98b1176b5 100644 (file)
@@ -428,8 +428,6 @@ public abstract class ScrollbarBundle implements DeferredWorker {
                 @Override
                 public void onScroll(ScrollEvent event) {
                     setOffsetSizeNow(px);
-                    offsetSizeTemporaryScrollHandler.removeHandler();
-                    offsetSizeTemporaryScrollHandler = null;
                 }
             });
             setScrollPos(0);
@@ -443,6 +441,10 @@ public abstract class ScrollbarBundle implements DeferredWorker {
         recalculateMaxScrollPos();
         forceScrollbar(showsScrollHandle());
         fireVisibilityChangeIfNeeded();
+        if (offsetSizeTemporaryScrollHandler != null) {
+            offsetSizeTemporaryScrollHandler.removeHandler();
+            offsetSizeTemporaryScrollHandler = null;
+        }
     }
 
     /**
@@ -609,8 +611,6 @@ public abstract class ScrollbarBundle implements DeferredWorker {
                 @Override
                 public void onScroll(ScrollEvent event) {
                     setScrollSizeNow(px);
-                    scrollSizeTemporaryScrollHandler.removeHandler();
-                    scrollSizeTemporaryScrollHandler = null;
                 }
             });
             setScrollPos(0);
@@ -624,6 +624,10 @@ public abstract class ScrollbarBundle implements DeferredWorker {
         recalculateMaxScrollPos();
         forceScrollbar(showsScrollHandle());
         fireVisibilityChangeIfNeeded();
+        if (scrollSizeTemporaryScrollHandler != null) {
+            scrollSizeTemporaryScrollHandler.removeHandler();
+            scrollSizeTemporaryScrollHandler = null;
+        }
     }
 
     /**
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java
new file mode 100644 (file)
index 0000000..19ba72b
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.grid.basicfeatures.escalator;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeaturesTest;
+
+/**
+ * Test class to test the escalator level issue for ticket #16832
+ */
+public class EscalatorRemoveAndAddRowsTest extends
+        EscalatorBasicClientFeaturesTest {
+
+    @Test
+    public void testRemoveAllRowsAndAddThirtyThenScroll() throws IOException {
+        openTestURL();
+
+        selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
+
+        scrollVerticallyTo(99999);
+        assertTrue("Escalator is not scrolled to bottom.",
+                isElementPresent(By.xpath("//td[text() = 'Row 99: 0,99']")));
+
+        selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, REMOVE_ALL_INSERT_SCROLL);
+
+        scrollVerticallyTo(99999);
+        assertTrue("Escalator is not scrolled to bottom.",
+                isElementPresent(By.xpath("//td[text() = 'Row 29: 0,129']")));
+    }
+}