aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorPiotr Wilkin <piotr.wilkin@syndatis.com>2017-10-10 12:02:47 +0200
committerHenri Sara <henri.sara@gmail.com>2017-10-10 13:02:47 +0300
commit802bb98b851ab9b15617b283ccdba3dbc517ada6 (patch)
tree1edbb81782e941e2a6332fe9b610f9d1fe357c87 /uitest
parenta8f23e84a0fbb5da515cacffb8f5a85fd4c21694 (diff)
downloadvaadin-framework-802bb98b851ab9b15617b283ccdba3dbc517ada6.tar.gz
vaadin-framework-802bb98b851ab9b15617b283ccdba3dbc517ada6.zip
Edit grid row by index - server side (#10040)
Opening grid editor from server side. Fixes #8477. Addressing #8820 will be the user's responsibility as fetching index of item might be slow.
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridEditorTest.java29
2 files changed, 32 insertions, 2 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
index 56d970308d..c9144e52f0 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
@@ -763,6 +763,11 @@ public class GridBasics extends AbstractTestUIWithLog {
editorMenu.addItem("Save", i -> grid.getEditor().save());
editorMenu.addItem("Cancel edit", i -> grid.getEditor().cancel());
+ Stream.of(0, 5, 100).forEach(i -> editorMenu.addItem("Edit row " + i,
+ menuItem -> grid.getEditor().editRow(i)));
+ editorMenu.addItem("Edit last row", menuItem -> grid.getEditor()
+ .editRow(grid.getDataCommunicator().getDataProviderSize() - 1));
+
editorMenu.addItem("Change save caption",
e -> grid.getEditor().setSaveCaption("ǝʌɐS"));
editorMenu.addItem("Change cancel caption",
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridEditorTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridEditorTest.java
index d8a49a5938..832e5e6651 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridEditorTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridEditorTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -37,8 +38,8 @@ public abstract class GridEditorTest extends GridBasicsTest {
.className("v-grid-editor-cancel");
protected static final org.openqa.selenium.By BY_EDITOR_SAVE = By
.className("v-grid-editor-save");
- protected static final String[] TOGGLE_EDIT_ENABLED = {
- "Component", "Editor", "Enabled" };
+ protected static final String[] TOGGLE_EDIT_ENABLED = { "Component",
+ "Editor", "Enabled" };
@Override
@Before
@@ -216,6 +217,30 @@ public abstract class GridEditorTest extends GridBasicsTest {
assertEditorClosed();
}
+ @Test
+ public void testEditorOpeningFromServer() {
+ selectMenuPath("Component", "Editor", "Edit row 5");
+ assertEditorOpen();
+
+ Assert.assertEquals("Unexpected editor field content", "5",
+ getEditor().getField(3).getAttribute("value"));
+ Assert.assertEquals("Unexpected not-editable column content", "(5, 1)",
+ getEditor().findElement(By.className("not-editable"))
+ .getText());
+ }
+
+ @Test
+ public void testEditorOpenWithScrollFromServer() {
+ selectMenuPath("Component", "Editor", "Edit last row");
+ assertEditorOpen();
+
+ Assert.assertEquals("Unexpected editor field content", "999",
+ getEditor().getField(3).getAttribute("value"));
+ Assert.assertEquals("Unexpected not-editable column content",
+ "(999, 1)", getEditor()
+ .findElement(By.className("not-editable")).getText());
+ }
+
protected WebElement getSaveButton() {
return getDriver().findElement(BY_EDITOR_SAVE);
}