summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorSebastian Nyholm <sebastian@vaadin.com>2014-05-27 14:46:47 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-18 11:34:03 +0000
commit1020faa337eddeb07f141cb7ef12fbb20bd2ded2 (patch)
tree3fe93c549eed111988c9c8f5d057b8cbadd5c9f0 /uitest
parenta960cfd12b8fb42ae78e39ffb61c04e3a3b831bf (diff)
downloadvaadin-framework-1020faa337eddeb07f141cb7ef12fbb20bd2ded2.tar.gz
vaadin-framework-1020faa337eddeb07f141cb7ef12fbb20bd2ded2.zip
Fixes DragAndDropWrapper does not support choosing a custom component as the drag image (#13836)
Amend : Fixes the comments for the last commit. Amend 2: Fixes a nullpointer found in a certain test scenario Change-Id: I72327f5f8ab9e46d88e1ebed8f1db3a7da39d7d8
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java31
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java1
2 files changed, 30 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
index b143ddf2dc..8539f70b17 100644
--- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
@@ -3,26 +3,53 @@ package com.vaadin.tests.components.draganddropwrapper;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.TestUtils;
import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
import com.vaadin.ui.DragAndDropWrapper;
import com.vaadin.ui.DragAndDropWrapper.DragStartMode;
import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
public class DragStartModes extends TestBase {
@Override
protected void setup() {
- TestUtils.injectCSS(getMainWindow(),
- ".v-ddwrapper { background: #ACF; }");
+ TestUtils
+ .injectCSS(getMainWindow(),
+ ".v-ddwrapper { background: #ACF; } .extra{ background: #FFA500; }");
addComponent(makeWrapper(DragStartMode.NONE));
addComponent(makeWrapper(DragStartMode.COMPONENT));
addComponent(makeWrapper(DragStartMode.WRAPPER));
addComponent(makeWrapper(DragStartMode.HTML5));
+ addComponent(makeOtherComponentWrapper(DragStartMode.COMPONENT_OTHER));
addComponent(new Label("Drop here"));
}
+ private Component makeOtherComponentWrapper(DragStartMode componentOther) {
+ VerticalLayout parent = new VerticalLayout();
+ parent.setWidth("200px");
+ parent.setSpacing(true);
+
+ CssLayout header = new CssLayout();
+ header.addComponent(new Label("Drag start mode : COMPONENT_OTHER"));
+ header.setSizeUndefined();
+
+ DragAndDropWrapper wrapper = new DragAndDropWrapper(header);
+ wrapper.setDragStartMode(DragStartMode.COMPONENT_OTHER);
+ wrapper.setDragImageComponent(parent);
+ wrapper.setId("label" + "COMPONENT_OTHER");
+ parent.addComponent(wrapper);
+
+ Label extra = new Label(
+ "Extra label that is not part of the wrapper. This should be dragged along with COMPONENT_OTHER.");
+ extra.addStyleName("extra");
+ parent.addComponent(extra);
+
+ return parent;
+ }
+
private Component makeWrapper(DragStartMode mode) {
Label label = new Label("Drag start mode: " + mode);
label.setId("label" + mode);
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java
index 25aef1b815..ba27ee293e 100644
--- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java
@@ -31,6 +31,7 @@ public class DragStartModesTest extends MultiBrowserTest {
WebElement dropTarget = vaadinElement("/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]");
dragToTarget("COMPONENT", dropTarget);
dragToTarget("WRAPPER", dropTarget);
+ dragToTarget("COMPONENT_OTHER", dropTarget);
}
private void dragToTarget(String dragMode, WebElement dropTarget)