summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-01-19 22:43:25 +0200
committerGitHub <noreply@github.com>2017-01-19 22:43:25 +0200
commitef299939b8b033e8a419afaf4032179acf591947 (patch)
tree8a8bea0212bb73dcfc760f1febc1d8d7534871f4
parent1adb7cea6a553274800e385483e2378e8c5b2802 (diff)
downloadvaadin-framework-ef299939b8b033e8a419afaf4032179acf591947.tar.gz
vaadin-framework-ef299939b8b033e8a419afaf4032179acf591947.zip
Fix navigation using keyboard to frozen column when there are hidden columns (#8277)
-rwxr-xr-xclient/src/main/java/com/vaadin/client/widgets/Grid.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java8
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridKeyboardNavigationTest.java16
4 files changed, 25 insertions, 8 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java
index ebccfc292d..69801fb0ff 100755
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -2587,9 +2587,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
++i;
} while (cell != null);
}
- int columnIndex = getColumns()
- .indexOf(getVisibleColumn(columnIndexDOM));
- if (columnIndex >= escalator.getColumnConfiguration()
+ if (columnIndexDOM >= escalator.getColumnConfiguration()
.getFrozenColumnCount()) {
escalator.scrollToColumn(columnIndexDOM, ScrollDestination.ANY,
10);
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
index 0c95e24700..6ee452c864 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
@@ -251,4 +251,9 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
}
return null;
}
+
+ protected void toggleColumnHidden(int column) {
+ selectMenuPath("Component", "Columns", "Column " + column, "Hidden");
+ }
+
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
index 0ed3de39d4..28d5df339c 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
@@ -153,13 +153,13 @@ public class GridColumnResizeTest extends GridBasicFeaturesTest {
selectMenuPath("Component", "Columns",
"Toggle all column hidden state");
// Hides although already hidden
- selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+ toggleColumnHidden(0);
// Shows
- selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+ toggleColumnHidden(0);
// Hides although already hidden
- selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+ toggleColumnHidden(2);
// Shows
- selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+ toggleColumnHidden(2);
GridCellElement cell = getGridElement().getCell(0, 1);
dragResizeColumn(1, 0, -cell.getSize().getWidth());
assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridKeyboardNavigationTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridKeyboardNavigationTest.java
index aacb32c982..0717ab5592 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridKeyboardNavigationTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridKeyboardNavigationTest.java
@@ -229,4 +229,18 @@ public class GridKeyboardNavigationTest extends GridBasicFeaturesTest {
column == focusedColumn
&& Math.abs(row - focusedRow) <= rowTolerance);
}
-} \ No newline at end of file
+
+ @Test
+ public void testNavigateOverHiddenColumnToFrozenColumn() {
+ openTestURL();
+ setFrozenColumns(3);
+ toggleColumnHidden(1);
+ getGridElement().getCell(0, 2).click();
+ assertFocusedCell(0, 2);
+ new Actions(getDriver()).sendKeys(Keys.ARROW_LEFT).perform();
+ assertFocusedCell(0, 1);
+ new Actions(getDriver()).sendKeys(Keys.ARROW_LEFT).perform();
+ assertFocusedCell(0, 0);
+ }
+
+}