From d9ff10864bc17bfd6e83725a293065b91d234904 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 19 Aug 2014 11:36:41 +0300 Subject: Implement selection with keyboard (#13334) Change-Id: I29a2ac38dfd613e952fd2f939ee8670271255aa3 --- .../basicfeatures/server/GridSelectionTest.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java index c190f7d0ec..6e2ac91df2 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.TestBenchElement; import com.vaadin.tests.components.grid.GridElement; @@ -123,6 +125,32 @@ public class GridSelectionTest extends GridBasicFeaturesTest { assertTrue("First row was not selected.", getRow(0).isSelected()); } + @Test + public void testKeyboardSelection() { + openTestURL(); + setSelectionModelMulti(); + + GridElement grid = getGridElement(); + grid.getCell(3, 1).click(); + new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); + + assertTrue("Grid row 3 was not selected with space key.", grid + .getRow(3).isSelected()); + + new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); + + assertTrue("Grid row 3 was not deselected with space key.", !grid + .getRow(3).isSelected()); + + grid.scrollToRow(500); + + new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); + + assertTrue("Grid row 3 was not selected with space key.", grid + .getRow(3).isSelected()); + + } + private void setSelectionModelMulti() { selectMenuPath("Component", "State", "Selection mode", "multi"); } -- cgit v1.2.3