summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/main/java/com/vaadin/client/widgets/Grid.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java10
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java22
3 files changed, 33 insertions, 2 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 69eec13d28..e55940582b 100644
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -3214,7 +3214,6 @@ public class Grid<T> extends ResizeComposite implements
private void calculate() {
isScheduled = false;
rescheduleCount = 0;
-
assert !dataIsBeingFetched : "Trying to calculate column widths even though data is still being fetched.";
if (columnsAreGuaranteedToBeWiderThanGrid()) {
@@ -5713,7 +5712,7 @@ public class Grid<T> extends ResizeComposite implements
initialWidth = col.getWidthActual();
minCellWidth = escalator
- .getMinCellWidth(getColumns()
+ .getMinCellWidth(getVisibleColumns()
.indexOf(col));
for (Column<?, T> c : getVisibleColumns()) {
if (selectionColumn == c) {
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
index 777f5f6775..c39feeb4da 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -1211,6 +1211,16 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
});
+ createBooleanAction("Toggle all column hidden state", "Columns", false,
+ new Command<Grid, Boolean>() {
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ for (Column col : grid.getColumns()) {
+ col.setHidden(!col.isHidden());
+ }
+ }
+ });
+
createBooleanAction("All columns resizable", "Columns", false,
new Command<Grid, Boolean>() {
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 7fdf7acbab..a452a60280 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
@@ -146,4 +146,26 @@ public class GridColumnResizeTest extends GridBasicFeaturesTest {
assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
10);
}
+
+ @Test
+ public void testShrinkColumnToZeroWithHiddenColumn() {
+ openTestURL();
+ selectMenuPath("Component", "Columns",
+ "Toggle all column hidden state");
+ // Hides although already hidden
+ selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+ // Shows
+ selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+ // Hides although already hidden
+ selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+ // Shows
+ selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+ GridCellElement cell = getGridElement().getCell(0, 1);
+ dragResizeColumn(1, 0, -cell.getSize().getWidth());
+ assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
+ 10);
+ assertEquals(getGridElement().getCell(0, 0).getLocation().getY(),
+ getGridElement().getCell(0, 1).getLocation().getY());
+ }
+
}