From 8f52c9801589824a18a80ad6c03ae1312dbfd7fd Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 9 Dec 2014 14:53:27 +0200 Subject: Remove selection column from single selection model (#13334) This patch makes some changes to selection model logic and refactors the space selection handling from MultiSelectionRenderer to its own class. Change-Id: I5c4a7d68531a8b4f38991719ae54c9f87119e9a4 --- .../basicfeatures/server/GridSelectionTest.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'uitest/src') 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 8a76acb60b..a242ad1dd1 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 @@ -150,7 +150,31 @@ public class GridSelectionTest extends GridBasicFeaturesTest { assertTrue("Grid row 3 was not selected with space key.", grid .getRow(3).isSelected()); + } + @Test + public void testKeyboardWithSingleSelection() { + openTestURL(); + setSelectionModelSingle(); + + 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()); } @Test @@ -194,6 +218,12 @@ public class GridSelectionTest extends GridBasicFeaturesTest { "Check box shouldn't have been in header for Single Selection Model", header.isElementPresent(By.tagName("input"))); + // Single selection model shouldn't have selection column to begin with + assertFalse( + "Selection columnn shouldn't have been in grid for Single Selection Model", + getGridElement().getCell(0, 1).isElementPresent( + By.tagName("input"))); + setSelectionModelNone(); header = getGridElement().getHeaderCell(0, 0); assertFalse( -- cgit v1.2.3