diff options
Diffstat (limited to 'uitest/src/test')
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java index 785bda8261..5b277f729f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java @@ -2,11 +2,12 @@ package com.vaadin.tests.components.grid; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; +import org.openqa.selenium.Keys; +import com.vaadin.testbench.By; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.NotificationElement; @@ -85,6 +86,39 @@ public class GridInTabSheetTest extends MultiBrowserTest { assertNoNotification(); } + @Test + public void testEditorOpenWhenSwitchingTab() { + setDebug(true); + openTestURL(); + + GridElement grid = $(GridElement.class).first(); + + grid.getCell(0, 1).doubleClick(); + assertEquals("Editor should be open", "0", + grid.getEditor().getField(1).getAttribute("value")); + + TabSheetElement tabsheet = $(TabSheetElement.class).first(); + tabsheet.openTab("Label"); + tabsheet.openTab("Grid"); + + grid = $(GridElement.class).first(); + assertFalse("Editor should be closed.", + grid.isElementPresent(By.vaadin("#editor"))); + + grid.getCell(1, 1).doubleClick(); + assertEquals("Editor should open after tab switch", "1", + grid.getEditor().getField(1).getAttribute("value")); + + // Close the current editor and reopen on a different row + grid.sendKeys(Keys.ESCAPE); + + grid.getCell(0, 1).doubleClick(); + assertEquals("Editor should move", "0", + grid.getEditor().getField(1).getAttribute("value")); + + assertNoErrorNotifications(); + } + private void removeGridRow() { $(ButtonElement.class).caption("Remove row from Grid").first().click(); } |