diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2015-05-06 11:52:47 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-05-15 11:11:23 +0000 |
commit | bdc28f77c6c629eec0a0129a1a791855a6fc435d (patch) | |
tree | 6eb7f60012480698f15f206035327984680144e4 /uitest | |
parent | 3a5cd8e4cd36a9db986978c01fe39356b3cbe3b6 (diff) | |
download | vaadin-framework-bdc28f77c6c629eec0a0129a1a791855a6fc435d.tar.gz vaadin-framework-bdc28f77c6c629eec0a0129a1a791855a6fc435d.zip |
Wrong floating element pos. on DND column reorder Grid #17693
When Grid was wider, the floating element did follow mouse to the
right after some point.
Also makes sure floating element is not shown on top of frozen columns
when auto scrolling left.
Change-Id: Ied779222c484f1f22119f89c0e720f868bbc898e
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java index 0d62797ea4..1714cdaaf3 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java @@ -22,8 +22,12 @@ import java.util.List; import org.junit.Before; import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest; /** @@ -320,6 +324,30 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { assertColumnHeaderOrder(1, 2, 0, 3); } + @Test + public void testColumnReordering_bigWidth_dragElementPositionCorrect() { + openTestURL(); + toggleColumnReordering(); + selectMenuPath("Component", "Size", "Width", "900px"); + assertColumnHeaderOrder(0, 1, 2, 3); + + GridCellElement draggedHeaderCell = getGridElement() + .getHeaderCell(0, 1); + final int xOffset = 500; + new Actions(getDriver()).moveToElement(draggedHeaderCell, 5, 5) + .clickAndHold().moveByOffset(xOffset, 0).build().perform(); + + WebElement floatingDragElement = findElement(By + .className("dragged-column-header")); + + int expectedLeft = draggedHeaderCell.getLocation().getX() + xOffset + 5 + - (floatingDragElement.getSize().getWidth() / 2); + int realLeft = floatingDragElement.getLocation().getX(); + + assertTrue("Dragged element location wrong, expected " + expectedLeft + + " was " + realLeft, Math.abs(expectedLeft - realLeft) < 5); + } + private void toggleColumnReordering() { selectMenuPath(COLUMN_REORDERING_PATH); } |