summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2016-12-22 11:40:21 +0200
committerDenis <denis@vaadin.com>2016-12-22 11:40:21 +0200
commit813c53c5260486757b3ef4d6dfe33ac73c75af32 (patch)
treef910ccfc69fd9c9f3290010925aa1b6085ac44d1 /uitest
parent8411a3a8fd80647f2d733bafae3ef29317aefdce (diff)
downloadvaadin-framework-813c53c5260486757b3ef4d6dfe33ac73c75af32.tar.gz
vaadin-framework-813c53c5260486757b3ef4d6dfe33ac73c75af32.zip
Use correct indexes in multiselect checkboxes after removing rows (#8072)
Fixes #8011
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
index a1dc542250..54dd1e37ab 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
@@ -18,6 +18,10 @@ package com.vaadin.tests.components.grid.basicfeatures.server;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
@@ -31,6 +35,7 @@ import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.elements.GridElement.GridRowElement;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
+import com.vaadin.tests.components.grid.basicfeatures.element.CustomGridElement;
public class GridSelectionTest extends GridBasicFeaturesTest {
@@ -396,6 +401,52 @@ public class GridSelectionTest extends GridBasicFeaturesTest {
"Exception occured, java.lang.NullPointerException: null"));
}
+ @Test
+ public void testRemoveSelectedRowMulti() {
+ openTestURL();
+
+ setSelectionModelMulti();
+ CustomGridElement grid = getGridElement();
+ grid.getCell(5, 0).click();
+
+ selectMenuPath("Component", "Body rows", "Remove selected rows");
+ assertSelected();
+ grid.getCell(5, 0).click();
+ assertSelected(5);
+ grid.getCell(6, 0).click();
+ assertSelected(5, 6);
+ grid.getCell(5, 0).click();
+ assertSelected(6);
+ grid.getCell(5, 0).click();
+ grid.getCell(4, 0).click();
+ selectMenuPath("Component", "Body rows", "Remove selected rows");
+ assertSelected();
+ grid.getCell(0, 0).click();
+ assertSelected(0);
+ grid.getCell(5, 0).click();
+ assertSelected(0, 5);
+ grid.getCell(6, 0).click();
+ assertSelected(0, 5, 6);
+
+ }
+
+ private void assertSelected(Integer... selected) {
+ CustomGridElement grid = getGridElement();
+ HashSet<Integer> expected = new HashSet<Integer>(
+ Arrays.asList(selected));
+ for (int i = 0; i < 10; i++) {
+ boolean rowSelected = grid.getRow(i).isSelected();
+ if (expected.contains(i)) {
+ Assert.assertTrue("Expected row " + i + " to be selected",
+ rowSelected);
+ } else {
+ Assert.assertFalse("Expected row " + i + " not to be selected",
+ rowSelected);
+ }
+ }
+
+ }
+
private void waitUntilCheckBoxValue(final WebElement checkBoxElememnt,
final boolean expectedValue) {
waitUntil(new ExpectedCondition<Boolean>() {