summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-03-24 09:22:10 +0200
committerHenri Sara <henri.sara@gmail.com>2017-03-24 09:22:10 +0200
commit6f1f83d4b95a45db03c5a74ad09b22541fb06e64 (patch)
tree937465d45919c8e284a8200fb66d490a78052f08 /uitest
parent6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b (diff)
downloadvaadin-framework-6f1f83d4b95a45db03c5a74ad09b22541fb06e64.tar.gz
vaadin-framework-6f1f83d4b95a45db03c5a74ad09b22541fb06e64.zip
Fix default header content changes on init (#8921)
This patch also enables an old test that was pending #8128 Fixes vaadin/framework8-issues#556
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java13
2 files changed, 17 insertions, 3 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java
index 10fad97259..e771b9cc78 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java
@@ -4,6 +4,8 @@ import com.vaadin.data.ValueProvider;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.Column;
+import com.vaadin.ui.Label;
import com.vaadin.ui.renderers.NumberRenderer;
public class GridAddColumn extends AbstractTestUI {
@@ -11,7 +13,10 @@ public class GridAddColumn extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
Grid<String> grid = new Grid<>();
- grid.addColumn(ValueProvider.identity());
+ Column<String, String> col0 = grid.addColumn(ValueProvider.identity())
+ .setCaption("First column");
+ grid.getDefaultHeaderRow().getCell(col0)
+ .setComponent(new Label("Label Header"));
grid.addColumn(String::length, new NumberRenderer());
grid.addColumn(String::length);
grid.addColumn(string -> -string.length());
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java
index f6755d1c31..ca5ad8ec50 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java
@@ -2,10 +2,11 @@ package com.vaadin.tests.components.grid;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
+import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
public class GridAddColumnTest extends SingleBrowserTest {
@@ -42,7 +43,6 @@ public class GridAddColumnTest extends SingleBrowserTest {
}
@Test
- @Ignore // TODO re-enable once #8128 is resolved
public void sort_column_with_automatic_conversion() {
grid.getHeaderCell(0, 2).click();
assertCellEquals(0, 0, "a");
@@ -55,6 +55,15 @@ public class GridAddColumnTest extends SingleBrowserTest {
assertCellEquals(2, 0, "a");
}
+ @Test
+ public void initial_header_content() {
+ GridCellElement firstHeader = grid.getHeaderCell(0, 0);
+ Assert.assertTrue("No label element in header",
+ firstHeader.isElementPresent(By.className("v-label")));
+ Assert.assertEquals("Text in label does not match", "Label Header",
+ firstHeader.getText());
+ }
+
private void assertCellEquals(int rowIndex, int colIndex, String content) {
Assert.assertEquals("Cell text should equal", content,
grid.getCell(rowIndex, colIndex).getText());