aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/test/java
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-02-03 13:27:51 +0200
committerPekka Hyvönen <pekka@vaadin.com>2017-02-03 13:27:51 +0200
commit0a325d95a588010a6d5c511afddb8db8048d50ee (patch)
tree8c70dcd594140dd1734bdcefdff4e83413eb1f7d /server/src/test/java
parent8163c0c77d5c099ef89a255ca87129a1422cda70 (diff)
downloadvaadin-framework-0a325d95a588010a6d5c511afddb8db8048d50ee.tar.gz
vaadin-framework-0a325d95a588010a6d5c511afddb8db8048d50ee.zip
Add selection methods to grid that delegate to its selection model (#8315)
* Add selection methods to grid that delegate to the selection model * Merge remote-tracking branch 'github/master' into 577-alt * Remove getFirstSelected, isSelected
Diffstat (limited to 'server/src/test/java')
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridDelegatesToSelectionModelTest.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridDelegatesToSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridDelegatesToSelectionModelTest.java
new file mode 100644
index 0000000000..ae121d2e03
--- /dev/null
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridDelegatesToSelectionModelTest.java
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components.grid;
+
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.components.grid.GridSelectionModel;
+
+public class GridDelegatesToSelectionModelTest {
+
+ private GridSelectionModel<String> selectionModelMock;
+
+ private CustomGrid grid;
+
+ private class CustomGrid extends Grid<String> {
+ CustomGrid() {
+ super();
+ setSelectionModel(selectionModelMock);
+ }
+ }
+
+ @Before
+ @SuppressWarnings("unchecked")
+ public void init() {
+ selectionModelMock = Mockito.mock(GridSelectionModel.class);
+ grid = new CustomGrid();
+ }
+
+ @Test
+ public void grid_getSelectedItems_delegated_to_SelectionModel() {
+ grid.getSelectedItems();
+ verify(selectionModelMock).getSelectedItems();
+ }
+
+ @Test
+ public void grid_select_delegated_to_SelectionModel() {
+ grid.select("");
+ verify(selectionModelMock).select("");
+ }
+
+ @Test
+ public void grid_deselect_delegated_to_SelectionModel() {
+ grid.deselect("");
+ verify(selectionModelMock).deselect("");
+ }
+
+ @Test
+ public void grid_deselectAll_delegated_to_SelectionModel() {
+ grid.deselectAll();
+ verify(selectionModelMock).deselectAll();
+ }
+}