summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-11-24 11:31:23 +0200
committerHenri Sara <henri.sara@gmail.com>2017-01-03 09:47:18 +0200
commit17b5c8dc396ea87a46ec76689fdff5771fabe5dd (patch)
treea792c49c66c292d9aaca6c28d0fc5cceaa289bb7 /uitest
parenta8835eaf31fd3a908647a71a26283f76383417bd (diff)
downloadvaadin-framework-17b5c8dc396ea87a46ec76689fdff5771fabe5dd.tar.gz
vaadin-framework-17b5c8dc396ea87a46ec76689fdff5771fabe5dd.zip
Re-add body rows when Escalator is reattached to DOM (#20477)
Change-Id: I0ae9144817db3bb730c80748d5e9190484b323e7 # Conflicts: # uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/MoveGridAndAddRow.java45
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java21
2 files changed, 66 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/MoveGridAndAddRow.java b/uitest/src/main/java/com/vaadin/tests/components/grid/MoveGridAndAddRow.java
new file mode 100644
index 0000000000..e27c3b5279
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/MoveGridAndAddRow.java
@@ -0,0 +1,45 @@
+package com.vaadin.tests.components.grid;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.data.ValueProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class MoveGridAndAddRow extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+
+ final VerticalLayout anotherLayout = new VerticalLayout();
+ anotherLayout.addComponent(new Label("This is another layout"));
+ final Grid<String> grid = new Grid<>();
+ grid.addColumn(ValueProvider.identity()).setCaption("A");
+ List<String> items = new ArrayList<>();
+ items.add("1");
+ grid.setItems(items);
+
+ final Button button = new Button("Add row and remove this button");
+ button.setId("add");
+ button.addClickListener(event -> {
+ items.add("2");
+ grid.setItems(items);
+ button.setVisible(false);
+ });
+
+ Button move = new Button("Move grid to other layout");
+ move.setId("move");
+ move.addClickListener(event -> anotherLayout.addComponent(grid));
+
+ layout.addComponents(button, move, grid);
+ addComponent(new HorizontalLayout(layout, anotherLayout));
+
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java
new file mode 100644
index 0000000000..c6d9aa394a
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java
@@ -0,0 +1,21 @@
+package com.vaadin.tests.components.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class MoveGridAndAddRowTest extends SingleBrowserTest {
+
+ @Test
+ public void addRowAndChangeLayout() {
+ openTestURL();
+ $(ButtonElement.class).id("add").click();
+
+ GridElement grid = $(GridElement.class).first();
+ Assert.assertEquals("1", grid.getCell(0, 0).getText());
+ Assert.assertEquals("2", grid.getCell(1, 0).getText());
+ }
+}