summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-01-19 08:52:35 +0200
committerDenis <denis@vaadin.com>2017-01-19 08:52:35 +0200
commit5e842da86887c302ca1865c67ebfbac59770487c (patch)
treeba56c93a030d93b15a3306165470af1f84feadb6 /uitest
parentcb0e182e8166572bfacd1cb52dfb0e5245fe5cd1 (diff)
downloadvaadin-framework-5e842da86887c302ca1865c67ebfbac59770487c.tar.gz
vaadin-framework-5e842da86887c302ca1865c67ebfbac59770487c.zip
Properly end HTML5 drag operations when no drop is performed (#8242)
* Properly end HTML5 drag operations when no drop is performed No auto test because of https://github.com/SeleniumHQ/selenium/issues/1365 Fixes #4060
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java80
1 files changed, 80 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java
new file mode 100644
index 0000000000..5bca514307
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java
@@ -0,0 +1,80 @@
+package com.vaadin.tests.components.draganddropwrapper;
+
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptAll;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion;
+import com.vaadin.event.dd.acceptcriteria.Not;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DragAndDropWrapper;
+import com.vaadin.ui.DragAndDropWrapper.DragStartMode;
+import com.vaadin.ui.Image;
+
+public class Html5DropDenied extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Image sample = new Image();
+ sample.setSource(new ThemeResource("../runo/icons/64/document.png"));
+
+ Button neverButton = new Button("Never accepts drop");
+ neverButton.setId("never");
+ neverButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ log("click on " + event.getButton().getCaption());
+ }
+ });
+
+ DragAndDropWrapper neverAccept = new DragAndDropWrapper(neverButton);
+ neverAccept.setSizeFull();
+ neverAccept.setDragStartMode(DragStartMode.NONE);
+ neverAccept.setDropHandler(new DropHandler() {
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return new Not((ClientSideCriterion) AcceptAll.get());
+ }
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ log("This should never happen");
+ }
+ });
+ Button alwaysButton = new Button("always accepts drop");
+ alwaysButton.setId("always");
+ alwaysButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ log("click on " + event.getButton().getCaption());
+ }
+ });
+
+ DragAndDropWrapper alwaysAccept = new DragAndDropWrapper(alwaysButton);
+ alwaysAccept.setSizeFull();
+ alwaysAccept.setDragStartMode(DragStartMode.NONE);
+ alwaysAccept.setDropHandler(new DropHandler() {
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return AcceptAll.get();
+ }
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ log("Drop on always accept");
+ }
+ });
+
+ addComponent(sample);
+ addComponent(neverAccept);
+ addComponent(alwaysAccept);
+
+ }
+
+}