diff options
author | Henri Sara <hesara@vaadin.com> | 2017-05-09 09:18:47 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-05-10 12:37:58 +0300 |
commit | 6f9825319a80797e22c83f855fe083dd93567137 (patch) | |
tree | d56a710a9c4141e6b171e0c8fd166fdc0f0c444c /uitest | |
parent | 027b14f484f9e072ebba9b8be7d9c0f3d87d39de (diff) | |
download | vaadin-framework-6f9825319a80797e22c83f855fe083dd93567137.tar.gz vaadin-framework-6f9825319a80797e22c83f855fe083dd93567137.zip |
Fix selection with space in TreeGrid/Tree
Makes subclasses of Grid call custom key and mouse event handlers.
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridBasicFeaturesTest.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridBasicFeaturesTest.java index b1b4da2c74..18b320abba 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridBasicFeaturesTest.java @@ -193,6 +193,51 @@ public class TreeGridBasicFeaturesTest extends MultiBrowserTest { } @Test + public void keyboard_selection() { + grid.getRow(0).getCell(0).click(); + + // Should expand "0 | 0" without moving focus + new Actions(getDriver()).sendKeys(Keys.RIGHT).perform(); + assertEquals(6, grid.getRowCount()); + assertCellTexts(1, 0, new String[] { "1 | 0", "1 | 1", "1 | 2" }); + + // Should navigate 2 times down to "1 | 1" + new Actions(getDriver()).sendKeys(Keys.DOWN, Keys.DOWN).perform(); + assertEquals(6, grid.getRowCount()); + assertCellTexts(1, 0, new String[] { "1 | 0", "1 | 1", "1 | 2" }); + assertFalse( + grid.getRow(0).hasClassName("v-treegrid-rowmode-row-focused")); + assertFalse( + grid.getRow(1).hasClassName("v-treegrid-rowmode-row-focused")); + assertTrue( + grid.getRow(2).hasClassName("v-treegrid-rowmode-row-focused")); + + // Should select "1 | 1" without moving focus + new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); + assertTrue(grid.getRow(2).hasClassName("v-treegrid-row-selected")); + + // Should move focus but not selection + new Actions(getDriver()).sendKeys(Keys.UP).perform(); + assertTrue( + grid.getRow(1).hasClassName("v-treegrid-rowmode-row-focused")); + assertFalse( + grid.getRow(2).hasClassName("v-treegrid-rowmode-row-focused")); + assertFalse(grid.getRow(1).hasClassName("v-treegrid-row-selected")); + assertTrue(grid.getRow(2).hasClassName("v-treegrid-row-selected")); + + // Should select "1 | 0" without moving focus + new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); + assertTrue( + grid.getRow(1).hasClassName("v-treegrid-rowmode-row-focused")); + assertFalse( + grid.getRow(2).hasClassName("v-treegrid-rowmode-row-focused")); + assertTrue(grid.getRow(1).hasClassName("v-treegrid-row-selected")); + assertFalse(grid.getRow(2).hasClassName("v-treegrid-row-selected")); + + assertNoErrorNotifications(); + } + + @Test public void changing_hierarchy_column() { assertTrue(grid.getRow(0).getCell(0) .isElementPresent(By.className("v-treegrid-expander"))); |