diff options
author | Denis <denis@vaadin.com> | 2016-12-15 17:41:34 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2016-12-15 17:41:34 +0200 |
commit | 80a406c075ecdc91c1c439a04796e72a7642bf23 (patch) | |
tree | d1012c72b7984ba87525a52b18c098aa1c07ac9c /uitest | |
parent | dc01a9a4d85f78dba63c310fb9dc478cf1d40f8d (diff) | |
download | vaadin-framework-80a406c075ecdc91c1c439a04796e72a7642bf23.tar.gz vaadin-framework-80a406c075ecdc91c1c439a04796e72a7642bf23.zip |
Add a SortListener to a Grid (#8008)8.0.0.alpha10
Fixes vaadin/framework8-issues#568
Diffstat (limited to 'uitest')
3 files changed, 21 insertions, 3 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java index 63ef591246..19867f9559 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java @@ -240,7 +240,12 @@ public class GridBasics extends AbstractTestUIWithLog { event -> log("ColumnResizeEvent: isUserOriginated? " + event.isUserOriginated())); - layout.addComponent(createMenu()); + grid.addSortListener(event -> log( + "SortEvent: isUserOriginated? " + event.isUserOriginated())); + + layout.addComponent( + + createMenu()); layout.addComponent(grid); addComponent(layout); } diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java index fa56567f19..49ee5c008a 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -53,7 +53,6 @@ import com.vaadin.v7.event.ItemClickEvent.ItemClickListener; import com.vaadin.v7.event.SelectionEvent; import com.vaadin.v7.event.SelectionEvent.SelectionListener; import com.vaadin.v7.event.SortEvent; -import com.vaadin.v7.event.SortEvent.SortListener; import com.vaadin.v7.shared.ui.grid.ColumnResizeMode; import com.vaadin.v7.shared.ui.grid.GridStaticCellType; import com.vaadin.v7.shared.ui.grid.HeightMode; @@ -357,7 +356,8 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { column.setHidable(isColumnHidableByDefault(col)); } - grid.addSortListener(new SortListener() { + grid.addSortListener(new SortEvent.SortListener() { + @Override public void sort(SortEvent event) { log("SortEvent: isUserOriginated? " + event.isUserOriginated()); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java index c172f53f3b..4a6ddc4f61 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java @@ -63,6 +63,9 @@ public class GridSortingTest extends GridBasicsTest { public void serverSideOrderByColumn0() { selectMenuPath("Component", "Columns", "Column 0", "Sort ASC"); + Assert.assertEquals("1. SortEvent: isUserOriginated? false", + getLogRow(0)); + Comparator<String> comparator = Comparator.naturalOrder(); int i = 0; @@ -76,6 +79,8 @@ public class GridSortingTest extends GridBasicsTest { Assert.assertTrue(i > 0); selectMenuPath("Component", "Columns", "Column 0", "Sort DESC"); + Assert.assertEquals("2. SortEvent: isUserOriginated? false", + getLogRow(0)); i = 0; for (String coord : getTestData().map(DataObject::getCoordinates) @@ -91,6 +96,9 @@ public class GridSortingTest extends GridBasicsTest { public void serverSideOrderByDate() { selectMenuPath("Component", "Columns", "Date", "Sort ASC"); + Assert.assertEquals("1. SortEvent: isUserOriginated? false", + getLogRow(0)); + Comparator<Date> comparator = Comparator.naturalOrder(); int i = 0; @@ -105,6 +113,8 @@ public class GridSortingTest extends GridBasicsTest { Assert.assertTrue(i > 0); selectMenuPath("Component", "Columns", "Date", "Sort DESC"); + Assert.assertEquals("2. SortEvent: isUserOriginated? false", + getLogRow(0)); i = 0; for (Date date : getTestData().map(DataObject::getDate) @@ -122,6 +132,9 @@ public class GridSortingTest extends GridBasicsTest { selectMenuPath("Component", "Columns", "Column 0", "Sort ASC"); selectMenuPath("Component", "Columns", "Clear sort"); + Assert.assertEquals("2. SortEvent: isUserOriginated? false", + getLogRow(0)); + int i = 0; for (String coord : getTestData().map(DataObject::getCoordinates) .limit(5).collect(Collectors.toList())) { |