summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-05-18 21:39:06 +0300
committerArtur Signell <artur@vaadin.com>2015-05-19 14:18:49 +0000
commita42fe556c27397c606183864909c9dd0e012d35a (patch)
tree19e7d9fb1e707f4971a840f75c70b32ff2609511 /uitest
parent8bafe0f91947c9f33b2d22c1595a17fb016bef8e (diff)
downloadvaadin-framework-a42fe556c27397c606183864909c9dd0e012d35a.tar.gz
vaadin-framework-a42fe556c27397c606183864909c9dd0e012d35a.zip
Handle generated empty string style names properly (#17335)
Change-Id: I1adce18f238fd4357b0eb1be68ebf7a3aaa6dd6e
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridHeaderStyleNames.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java34
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java22
3 files changed, 57 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridHeaderStyleNames.java b/uitest/src/com/vaadin/tests/components/grid/GridHeaderStyleNames.java
index 765cd01812..019850dabb 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridHeaderStyleNames.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridHeaderStyleNames.java
@@ -46,7 +46,7 @@ public class GridHeaderStyleNames extends AbstractTestUIWithLog {
.createContainer(100));
ageHeaderCell = grid.getDefaultHeaderRow().getCell("age");
-
+ grid.getDefaultHeaderRow().setStyleName("foo");
headerRow = grid.prependHeaderRow();
mergedCityCountryCell = headerRow.join("city", "country");
mergedCityCountryCell.setText("Merged cell");
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 18f2d02e93..ecf3d53385 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -83,9 +83,13 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS_FOR_3_OF_4 = "Row numbers for 3/4";
public static final String ROW_STYLE_GENERATOR_NONE = "None";
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS = "Row numbers";
+ public static final String ROW_STYLE_GENERATOR_EMPTY = "Empty string";
+ public static final String ROW_STYLE_GENERATOR_NULL = "Null";
public static final String CELL_STYLE_GENERATOR_NONE = "None";
public static final String CELL_STYLE_GENERATOR_PROPERTY_TO_STRING = "Property to string";
public static final String CELL_STYLE_GENERATOR_SPECIAL = "Special for 1/4 Column 1";
+ public static final String CELL_STYLE_GENERATOR_EMPTY = "Empty string";
+ public static final String CELL_STYLE_GENERATOR_NULL = "Null";
private static final int MANUALLY_FORMATTED_COLUMNS = 5;
public static final int COLUMNS = 12;
public static final int EDITABLE_COLUMNS = COLUMNS - 1;
@@ -514,6 +518,22 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
}
});
+ rowStyleGenerators.put(ROW_STYLE_GENERATOR_EMPTY,
+ new RowStyleGenerator() {
+
+ @Override
+ public String getStyle(RowReference rowReference) {
+ return "";
+ }
+ });
+ rowStyleGenerators.put(ROW_STYLE_GENERATOR_NULL,
+ new RowStyleGenerator() {
+
+ @Override
+ public String getStyle(RowReference rowReference) {
+ return null;
+ }
+ });
cellStyleGenerators.put(CELL_STYLE_GENERATOR_NONE, null);
cellStyleGenerators.put(CELL_STYLE_GENERATOR_PROPERTY_TO_STRING,
new CellStyleGenerator() {
@@ -539,6 +559,20 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
return propertyId.toString().replace(' ', '_');
}
});
+ cellStyleGenerators.put(CELL_STYLE_GENERATOR_EMPTY,
+ new CellStyleGenerator() {
+ @Override
+ public String getStyle(CellReference cellReference) {
+ return "";
+ }
+ });
+ cellStyleGenerators.put(CELL_STYLE_GENERATOR_NULL,
+ new CellStyleGenerator() {
+ @Override
+ public String getStyle(CellReference cellReference) {
+ return null;
+ }
+ });
createSelectAction("Row style generator", "State", rowStyleGenerators,
CELL_STYLE_GENERATOR_NONE,
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java
index 643c61d90a..f013b76075 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java
@@ -118,4 +118,26 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest {
private void selectCellStyleNameGenerator(String name) {
selectMenuPath("Component", "State", "Cell style generator", name);
}
+
+ @Test
+ public void testEmptyStringStyleGenerator() {
+ setDebug(true);
+ openTestURL();
+ selectCellStyleNameGenerator(GridBasicFeatures.CELL_STYLE_GENERATOR_EMPTY);
+ selectRowStyleNameGenerator(GridBasicFeatures.ROW_STYLE_GENERATOR_EMPTY);
+
+ assertFalse("Error notification was present",
+ isElementPresent(NotificationElement.class));
+ }
+
+ @Test
+ public void testNullStringStyleGenerator() {
+ setDebug(true);
+ openTestURL();
+ selectCellStyleNameGenerator(GridBasicFeatures.CELL_STYLE_GENERATOR_NULL);
+ selectRowStyleNameGenerator(GridBasicFeatures.ROW_STYLE_GENERATOR_NULL);
+
+ assertFalse("Error notification was present",
+ isElementPresent(NotificationElement.class));
+ }
}