summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-03-28 10:07:00 +0300
committerPekka Hyvönen <pekka@vaadin.com>2017-03-28 10:07:00 +0300
commit91590e9f6c91de1fcfd9534263a2e270d973d384 (patch)
tree4b973e064e37af021e3f38c14d104ad76e7b8e83 /uitest
parente3e96a674c13eae5516a5d8d2085917a3859e4d0 (diff)
downloadvaadin-framework-91590e9f6c91de1fcfd9534263a2e270d973d384.tar.gz
vaadin-framework-91590e9f6c91de1fcfd9534263a2e270d973d384.zip
Fix data not being sent again when adding DataGenerators (#8947)
* Fix data not being sent again when adding DataGenerators * Fix header component detaching, revert early header cleanup
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java18
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java15
2 files changed, 31 insertions, 2 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 e771b9cc78..8846091512 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
@@ -1,18 +1,34 @@
package com.vaadin.tests.components.grid;
+import com.vaadin.annotations.Widgetset;
import com.vaadin.data.ValueProvider;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Notification;
import com.vaadin.ui.renderers.NumberRenderer;
+@Widgetset("com.vaadin.DefaultWidgetSet")
public class GridAddColumn extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
Grid<String> grid = new Grid<>();
+ createColumns(grid);
+ grid.setItems("a", "aa", "aaa");
+ addComponent(grid);
+
+ addComponent(new Button("Replace columns", e -> {
+ grid.removeAllColumns();
+ createColumns(grid);
+ Notification.show("Columns replaced.");
+ }));
+ }
+
+ private void createColumns(Grid<String> grid) {
Column<String, String> col0 = grid.addColumn(ValueProvider.identity())
.setCaption("First column");
grid.getDefaultHeaderRow().getCell(col0)
@@ -21,7 +37,5 @@ public class GridAddColumn extends AbstractTestUI {
grid.addColumn(String::length);
grid.addColumn(string -> -string.length());
grid.addColumn(string -> new Object());
- grid.setItems("a", "aa", "aaa");
- addComponent(grid);
}
}
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 ca5ad8ec50..e3595e7674 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
@@ -5,8 +5,10 @@ import org.junit.Before;
import org.junit.Test;
import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
public class GridAddColumnTest extends SingleBrowserTest {
@@ -64,6 +66,19 @@ public class GridAddColumnTest extends SingleBrowserTest {
firstHeader.getText());
}
+ @Test
+ public void replace_all_columns() {
+ $(ButtonElement.class).first().click();
+
+ // Verify button got clicked
+ Assert.assertTrue(isElementPresent(NotificationElement.class));
+ Assert.assertEquals("Columns replaced.",
+ $(NotificationElement.class).first().getText());
+
+ // Run default rendering test
+ columns_rendered_correctly();
+ }
+
private void assertCellEquals(int rowIndex, int colIndex, String content) {
Assert.assertEquals("Cell text should equal", content,
grid.getCell(rowIndex, colIndex).getText());