diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-07-09 12:31:47 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-07-09 12:32:05 +0300 |
commit | 5837c103f7dd30f5611cb180e610f3d3f316b6d0 (patch) | |
tree | 5137f3c9f0054b7419ec1fdb78dea40e402ffa70 /uitest | |
parent | 42ce49c1298d6574c56905011ccef8ebdae87927 (diff) | |
download | vaadin-framework-5837c103f7dd30f5611cb180e610f3d3f316b6d0.tar.gz vaadin-framework-5837c103f7dd30f5611cb180e610f3d3f316b6d0.zip |
Fix displaying Details when Grid is attached to DOM (#18390)
Change-Id: I74360c7a3f0c5798dbaa44ea06ea1585c4289449
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java | 23 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java | 32 |
2 files changed, 49 insertions, 6 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java index c25ad287b7..1032378a2d 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java @@ -35,7 +35,7 @@ public class GridDetailsDetach extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final VerticalLayout layout = new VerticalLayout(); + VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); Button button = new Button("Test"); @@ -43,19 +43,30 @@ public class GridDetailsDetach extends AbstractTestUI { layout.setExpandRatio(button, 0f); currentGrid = generateGrid(); - layout.addComponent(currentGrid); - layout.setExpandRatio(currentGrid, 1f); + final VerticalLayout gridContainer = new VerticalLayout(); + gridContainer.addComponent(currentGrid); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - Grid newGrid = generateGrid(); - layout.replaceComponent(currentGrid, newGrid); - currentGrid = newGrid; + gridContainer.replaceComponent(currentGrid, new Label("Foo")); } }); + layout.addComponent(new Button("Reattach Grid", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + gridContainer.removeAllComponents(); + gridContainer.addComponent(currentGrid); + } + })); + + layout.addComponent(gridContainer); + layout.setExpandRatio(gridContainer, 1f); + addComponent(layout); } diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java index f9071dd3da..fc79fd1b68 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java @@ -15,7 +15,12 @@ */ package com.vaadin.tests.components.grid; +import java.util.List; + +import org.junit.Assert; import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.GridElement; @@ -31,11 +36,38 @@ public class GridDetailsDetachTest extends MultiBrowserTest { openTestURL(); $(GridElement.class).first().getCell(3, 0).click(); + $(GridElement.class).first().getCell(5, 0).click(); + + assertNoErrorNotifications(); + + $(ButtonElement.class).first().click(); + + assertNoErrorNotifications(); + } + + @Test + public void testDetachAndReattachGridWithDetailsOpen() { + setDebug(true); + openTestURL(); + + $(GridElement.class).first().getCell(3, 0).click(); + $(GridElement.class).first().getCell(5, 0).click(); assertNoErrorNotifications(); $(ButtonElement.class).first().click(); assertNoErrorNotifications(); + + $(ButtonElement.class).get(1).click(); + + assertNoErrorNotifications(); + + List<WebElement> spacers = findElements(By.className("v-grid-spacer")); + Assert.assertEquals("Not enough spacers in DOM", 2, spacers.size()); + Assert.assertEquals("Spacer content not visible", + "Extra data for Bean 3", spacers.get(0).getText()); + Assert.assertEquals("Spacer content not visible", + "Extra data for Bean 5", spacers.get(1).getText()); } } |