summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2015-10-05 17:46:28 +0300
committerMarkus Koivisto <markus@vaadin.com>2015-10-09 12:33:21 +0000
commit2732b77278001c11fd5059fb89f19587302cb033 (patch)
tree2ecb166c2b0cbd1391f0f1bcd31cc58cdbec0a46 /uitest
parent9ee97bbf72551ba650e7ea910dddaae64f6c7ef0 (diff)
downloadvaadin-framework-2732b77278001c11fd5059fb89f19587302cb033.tar.gz
vaadin-framework-2732b77278001c11fd5059fb89f19587302cb033.zip
Add Grid column resize event API (#16838)
Change-Id: I1cdecb54b3df45b16ddf2c7b06261198be086274
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSortingTest.java2
3 files changed, 26 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
index 30cc8a2b13..a3160ba2c6 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -60,6 +60,8 @@ import com.vaadin.ui.Grid.CellStyleGenerator;
import com.vaadin.ui.Grid.Column;
import com.vaadin.ui.Grid.ColumnReorderEvent;
import com.vaadin.ui.Grid.ColumnReorderListener;
+import com.vaadin.ui.Grid.ColumnResizeEvent;
+import com.vaadin.ui.Grid.ColumnResizeListener;
import com.vaadin.ui.Grid.ColumnVisibilityChangeEvent;
import com.vaadin.ui.Grid.ColumnVisibilityChangeListener;
import com.vaadin.ui.Grid.DetailsGenerator;
@@ -354,8 +356,15 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
grid.addSortListener(new SortListener() {
@Override
public void sort(SortEvent event) {
+ log("SortEvent: isUserOriginated? " + event.isUserOriginated());
+ }
+ });
- log("SortOrderChangeEvent: isUserOriginated? "
+ grid.addColumnResizeListener(new ColumnResizeListener() {
+
+ @Override
+ public void columnResize(ColumnResizeEvent event) {
+ log("ColumnResizeEvent : isUserOriginated? "
+ event.isUserOriginated());
}
});
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
index 827a132eb9..7c62571cb1 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
@@ -16,10 +16,13 @@
package com.vaadin.tests.components.grid.basicfeatures.server;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.parallel.TestCategory;
@@ -84,4 +87,16 @@ public class GridColumnResizeTest extends GridBasicFeaturesTest {
cell.isElementPresent(By
.cssSelector("div.v-grid-column-resize-handle")));
}
+
+ @Test
+ public void testResizeFirstColumn() {
+ GridCellElement headerCell = getGridElement().getHeaderCell(0, 0);
+ Dimension size = headerCell.getSize();
+ new Actions(getDriver())
+ .moveToElement(headerCell, size.getWidth() - 1,
+ size.getHeight() / 2).clickAndHold()
+ .moveByOffset(-10, 0).release().perform();
+ assertTrue("Log did not contain a resize event.",
+ logContainsText("ColumnResizeEvent : isUserOriginated? true"));
+ }
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSortingTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSortingTest.java
index cbd0857bd1..b471612798 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSortingTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSortingTest.java
@@ -379,7 +379,7 @@ public class GridSortingTest extends GridBasicFeaturesTest {
// Find a message in the log
List<WebElement> userOriginatedMessages = getDriver()
.findElements(
- By.xpath("//div[@id='Log']//*[contains(text(),'SortOrderChangeEvent: isUserOriginated')]"));
+ By.xpath("//div[@id='Log']//*[contains(text(),'SortEvent: isUserOriginated')]"));
Collections.sort(userOriginatedMessages, new Comparator<WebElement>() {
@Override