]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix Editor overlay position when footer is displayed on top (#19491)
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 19 Jan 2016 18:46:05 +0000 (20:46 +0200)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Fri, 5 Feb 2016 14:32:09 +0000 (14:32 +0000)
Change-Id: Ifffe66c8a872fe3625cf8c60115b172610b6e9b5

client/src/com/vaadin/client/widgets/Grid.java
uitest/src/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java

index 0de5e7a239414a602a288c2ff3b68f904e30079c..252bcfed3c28cea6f8946d09608a0a92396f1062 100644 (file)
@@ -1817,9 +1817,7 @@ public class Grid<T> extends ResizeComposite implements
                 @Override
                 public void onScroll(ScrollEvent event) {
                     updateHorizontalScrollPosition();
-                    if (!isBuffered()) {
-                        updateVerticalScrollPosition();
-                    }
+                    updateVerticalScrollPosition();
                 }
             });
 
@@ -2109,6 +2107,10 @@ public class Grid<T> extends ResizeComposite implements
          * row container if the edited row is scrolled out of the visible area.
          */
         private void updateVerticalScrollPosition() {
+            if (isBuffered()) {
+                return;
+            }
+
             double newScrollTop = grid.getScrollTop();
 
             int gridTop = grid.getElement().getAbsoluteTop();
index 769fa5232351372d993f1625da185deef6e41392..df250357d82ec30322cfcb63898ab7ed4512cf99 100644 (file)
@@ -15,6 +15,8 @@
  */
 package com.vaadin.tests.fieldgroup;
 
+import static org.junit.Assert.assertFalse;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -89,4 +91,23 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest {
         Assert.assertNotEquals("Checkbox value did not change", value,
                 cb.getValue());
     }
+
+    @Test
+    public void testNoTopStyleSetOnEditorOpenWithFooterOnTop() {
+        GridCellElement cell = grid.getCell(2, 3);
+        // Open editor row
+        new Actions(getDriver()).doubleClick(cell).perform();
+
+        // Close editor
+        new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform();
+
+        cell = grid.getCell(14, 3);
+
+        // Open editor row
+        new Actions(getDriver()).doubleClick(cell).perform();
+
+        String attribute = grid.getEditor().getAttribute("style").toLowerCase();
+        assertFalse("Style should not contain top.", attribute.contains("top:"));
+    }
+
 }