diff options
author | Patrik Lindström <patrik@vaadin.com> | 2014-06-17 18:30:04 +0300 |
---|---|---|
committer | Patrik Lindström <patrik@vaadin.com> | 2014-06-26 16:15:05 +0300 |
commit | 6294a26ab8ae5df83d25318c4a8b14db34f5b8a4 (patch) | |
tree | 6513a1c58d8b0e9b1699981269c630335ddd858b /client/tests | |
parent | f4a538019bc6c5abeeb453d9f116088d03d7c32f (diff) | |
download | vaadin-framework-6294a26ab8ae5df83d25318c4a8b14db34f5b8a4.tar.gz vaadin-framework-6294a26ab8ae5df83d25318c4a8b14db34f5b8a4.zip |
Implement Grid client-side Sorting API (#13334)
Change-Id: I9ab18c93bdc1aaf66aa2701c3939311671a60f04
Diffstat (limited to 'client/tests')
-rw-r--r-- | client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java b/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java index 5c5e88bf69..823eb224ea 100644 --- a/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java +++ b/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2013 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -16,8 +16,10 @@ package com.vaadin.client.ui.grid; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Arrays; +import java.util.Comparator; import org.easymock.EasyMock; import org.junit.Test; @@ -26,7 +28,7 @@ import com.vaadin.client.data.DataChangeHandler; import com.vaadin.client.ui.grid.datasources.ListDataSource; /** - * + * * @since 7.2 * @author Vaadin Ltd */ @@ -175,4 +177,21 @@ public class ListDataSourceTest { ds.asList().iterator().remove(); } + @Test + public void sortColumn() { + ListDataSource<Integer> ds = new ListDataSource<Integer>(3, 4, 2, 3, 1); + + // TODO Should be simplified to sort(). No point in providing these + // trivial comparators. + ds.sort(new Comparator<Integer>() { + @Override + public int compare(Integer o1, Integer o2) { + return o1.compareTo(o2); + } + }); + + assertTrue(Arrays.equals(ds.asList().toArray(), new Integer[] { 1, 2, + 3, 3, 4 })); + } + } |