From 5c56d140bebc5aaf23790c6abb081f5f2b2a5cf6 Mon Sep 17 00:00:00 2001 From: Teppo Kurki Date: Tue, 18 Aug 2015 21:46:39 +0300 Subject: Cut off Grid cell content when max column width is set (#18617) Change-Id: I912377ffe366e6ac46280b374fa04caa59c3bcf2 --- .../grid/basicfeatures/GridBasicFeatures.java | 12 +++++++ .../server/GridColumnMaxWidthTest.java | 37 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 23226fb6cf..479ece71ca 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -1174,6 +1174,18 @@ public class GridBasicFeatures extends AbstractComponentTest { } }); + + createClickAction("All columns expanding, Col 0 has max width of 30px", + "Columns", new Command() { + + @Override + public void execute(Grid c, Boolean value, Object data) { + for (Column col : grid.getColumns()) { + col.setWidthUndefined(); + } + grid.getColumns().get(0).setMaximumWidth(30); + } + }, null); } private static String getColumnProperty(int c) { diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java new file mode 100644 index 0000000000..dffa22fdc6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java @@ -0,0 +1,37 @@ +/* + * 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.server; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest; + +public class GridColumnMaxWidthTest extends GridBasicFeaturesTest { + + @Test + public void testRemovingAllColumns() { + setDebug(true); + openTestURL(); + + selectMenuPath("Component", "Columns", + "All columns expanding, Col 0 has max width of 30px"); + + assertEquals("Column 0 did not obey max width of 30px.", "30px", + getGridElement().getCell(0, 0).getCssValue("width")); + } +} \ No newline at end of file -- cgit v1.2.3