summaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-06-19 10:49:40 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-06-19 09:49:40 +0200
commitc99ac74e86d3545cb3b580d73abcb582660808b6 (patch)
tree654a0e7675573e46feba2e6ea1f89f8ab13050f4 /uitest/src/test
parent7294ab52fe8a5fd389bac22eeaeeb3cec4f82fbb (diff)
downloadvaadin-framework-c99ac74e86d3545cb3b580d73abcb582660808b6.tar.gz
vaadin-framework-c99ac74e86d3545cb3b580d73abcb582660808b6.zip
Fix TabSheet attaching and detaching components (#10988)
This patch reverts the fix #10557 and replaces it with a proper solution from Grid perspective. Fixes #10987 Fixes #10985
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java36
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();
}