aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-12-05 20:17:56 +0200
committerVaadin Code Review <review@vaadin.com>2014-12-08 09:00:51 +0000
commit167a9bcc33d5c36e148dae04d63f37ca7f01f34b (patch)
treeffa40a04d8fb2dd0e9aef65a17fce502ab6e1734 /uitest/src
parent912c90eee32699d1cf62789de0b3a055151fd483 (diff)
downloadvaadin-framework-167a9bcc33d5c36e148dae04d63f37ca7f01f34b.tar.gz
vaadin-framework-167a9bcc33d5c36e148dae04d63f37ca7f01f34b.zip
Properly destroy and init cells when changing column order (#13334)
Change-Id: I79aa8fc5f68a7f876f4f3371231df795210f37d4
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/WidgetRenderers.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/WidgetRenderersTest.java21
2 files changed, 33 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/WidgetRenderers.java b/uitest/src/com/vaadin/tests/components/grid/WidgetRenderers.java
index fa39fda3e6..8c6037938c 100644
--- a/uitest/src/com/vaadin/tests/components/grid/WidgetRenderers.java
+++ b/uitest/src/com/vaadin/tests/components/grid/WidgetRenderers.java
@@ -21,6 +21,8 @@ import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.components.grid.renderers.ButtonRenderer;
@@ -49,7 +51,7 @@ public class WidgetRenderers extends AbstractTestUI {
item.getItemProperty(ImageRenderer.class).setValue(
new ThemeResource("window/img/close.png"));
- Grid grid = new Grid(container);
+ final Grid grid = new Grid(container);
grid.setId("test-grid");
grid.setSelectionMode(SelectionMode.NONE);
@@ -77,6 +79,15 @@ public class WidgetRenderers extends AbstractTestUI {
}));
addComponent(grid);
+
+ addComponent(new Button("Change column order",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ grid.setColumnOrder(ImageRenderer.class,
+ ProgressBarRenderer.class, ButtonRenderer.class);
+ }
+ }));
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/grid/WidgetRenderersTest.java b/uitest/src/com/vaadin/tests/components/grid/WidgetRenderersTest.java
index d130eb643c..595e02655b 100644
--- a/uitest/src/com/vaadin/tests/components/grid/WidgetRenderersTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/WidgetRenderersTest.java
@@ -16,12 +16,15 @@
package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.annotations.TestCategory;
import com.vaadin.tests.components.grid.GridElement.GridCellElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -70,6 +73,24 @@ public class WidgetRenderersTest extends MultiBrowserTest {
.endsWith("window/img/maximize.png"));
}
+ @Test
+ public void testColumnReorder() {
+ setDebug(true);
+ openTestURL();
+
+ $(ButtonElement.class).caption("Change column order").first().click();
+
+ assertFalse("Notification was present",
+ isElementPresent(NotificationElement.class));
+
+ assertTrue(getGridCell(0, 0)
+ .isElementPresent(By.className("gwt-Image")));
+ assertTrue(getGridCell(0, 1).isElementPresent(
+ By.className("v-progressbar")));
+ assertTrue(getGridCell(0, 2).isElementPresent(
+ By.className("gwt-Button")));
+ }
+
GridCellElement getGridCell(int row, int col) {
return $(GridElement.class).first().getCell(row, col);
}