]> source.dussan.org Git - vaadin-framework.git/commitdiff
Flush the correct editor widget if there are hidden columns (#8276)
authorArtur <artur@vaadin.com>
Fri, 20 Jan 2017 08:18:46 +0000 (10:18 +0200)
committerAleksi Hietanen <aleksi@vaadin.com>
Fri, 20 Jan 2017 08:18:46 +0000 (10:18 +0200)
Fixes #8266

client/src/main/java/com/vaadin/client/widgets/Grid.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java

index 69801fb0ffdee2d293778d82f262567cdfe54ac8..f796529aa786bea779c07716eadb31f93153c654 100755 (executable)
@@ -7456,8 +7456,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
             if (editor.focusedColumnIndexDOM < 0) {
                 widget = null;
             } else {
-                widget = editor
-                        .getWidget(getColumn(editor.focusedColumnIndexDOM));
+                widget = editor.getWidget(
+                        getVisibleColumn(editor.focusedColumnIndexDOM));
             }
 
             EditorDomEvent<T> editorEvent = new EditorDomEvent<T>(
index 34d46eae78c6c738be04204cee99d9eb8dbaa860..34e9b053d150ff221cc180a725cbdf0981fddbde 100644 (file)
@@ -45,8 +45,25 @@ public class GridEditorBufferedTest extends GridEditorTest {
     @Test
     public void testKeyboardSave() {
         selectMenuPath(EDIT_ITEM_100);
-
         WebElement textField = getEditorWidgets().get(0);
+        textField.click();
+        // without this, the click in the middle of the field might not be after
+        // the old text on some browsers
+        new Actions(getDriver()).sendKeys(Keys.END).perform();
+        textField.sendKeys(" changed");
+        // Save from keyboard
+        new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+        assertEditorClosed();
+        assertEquals("(100, 0) changed",
+                getGridElement().getCell(100, 0).getText());
+    }
+
+    @Test
+    public void testKeyboardSaveWithHiddenColumn() {
+        selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+        selectMenuPath(EDIT_ITEM_100);
+
+        WebElement textField = getEditorWidgets().get(1);
 
         textField.click();
         // without this, the click in the middle of the field might not be after
@@ -59,8 +76,8 @@ public class GridEditorBufferedTest extends GridEditorTest {
         new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
 
         assertEditorClosed();
-        assertEquals("(100, 0) changed",
-                getGridElement().getCell(100, 0).getText());
+        assertEquals("(100, 2) changed",
+                getGridElement().getCell(100, 1).getText());
     }
 
     @Test