diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-07-09 19:20:19 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2014-07-10 12:11:35 +0000 |
commit | b36c0fc7e01def912430be5d9a42d344d8202046 (patch) | |
tree | 840564175a2176ac7bd512ab0df6980d2133104e /uitest/src | |
parent | 2ef88966831c2bc64e5be645ff3bda2adb58f70a (diff) | |
download | vaadin-framework-b36c0fc7e01def912430be5d9a42d344d8202046.tar.gz vaadin-framework-b36c0fc7e01def912430be5d9a42d344d8202046.zip |
GridConnector sends user sort events to the server (#13334)
Change-Id: Ic5b1462ecf2e5a5cef6b08bea7a4c00a09c39c9a
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridBasicFeaturesTest.java | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridBasicFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/GridBasicFeaturesTest.java index d09f55537d..59f6311995 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridBasicFeaturesTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridBasicFeaturesTest.java @@ -374,7 +374,7 @@ public class GridBasicFeaturesTest extends MultiBrowserTest { } @Test - public void testSorting() throws IOException { + public void testProgrammaticSorting() throws IOException { openTestURL(); GridElement grid = getGridElement(); @@ -418,6 +418,57 @@ public class GridBasicFeaturesTest extends MultiBrowserTest { } } + @Test + public void testUserSorting() { + openTestURL(); + + GridElement grid = getGridElement(); + + // Sorting by column 9 is sorting by row index that is represented as a + // String. + // First cells for first 3 rows are (9, 0), (99, 0) and (999, 0) + + // Click header twice to sort descending + grid.getHeaderCell(0, 9).click(); + grid.getHeaderCell(0, 9).click(); + String row = ""; + for (int i = 0; i < 3; ++i) { + row += "9"; + assertEquals( + "Grid is not sorted by Column9 using descending direction.", + "(" + row + ", 0)", grid.getCell(i, 0).getText()); + } + + // Column 10 is random numbers from Random with seed 13334 + // Click header to sort ascending + grid.getHeaderCell(0, 10).click(); + + // Not cleaning up correctly causes exceptions when scrolling. + grid.scrollToRow(50); + assertFalse("Scrolling caused and exception when shuffled.", + getLogRow(0).contains("Exception")); + + for (int i = 0; i < 5; ++i) { + assertGreater( + "Grid is not sorted by Column10 using ascending direction", + Integer.parseInt(grid.getCell(i + 1, 10).getText()), + Integer.parseInt(grid.getCell(i, 10).getText())); + + } + + // Column 7 is row index as a number. Last three row are original rows + // 2, 1 and 0. + // Click header twice to sort descending + grid.getHeaderCell(0, 7).click(); + grid.getHeaderCell(0, 7).click(); + for (int i = 0; i < 3; ++i) { + assertEquals( + "Grid is not sorted by Column7 using descending direction", + "(" + i + ", 0)", + grid.getCell(GridBasicFeatures.ROWS - (i + 1), 0).getText()); + } + } + private void sortBy(String column) { selectMenuPath("Component", "State", "Sort by column", column); } |