]> source.dussan.org Git - vaadin-framework.git/commitdiff
renamed html file so that test bench don't think it is a test script
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 21 Nov 2011 14:18:08 +0000 (14:18 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 21 Nov 2011 14:18:08 +0000 (14:18 +0000)
svn changeset:22084/svn branch:6.8

tests/testbench/com/vaadin/tests/dd/StartHtml5Drag.java
tests/testbench/com/vaadin/tests/dd/html5drop.htm [new file with mode: 0644]

index 5a682de8cec86a7820881bb8cd0efcd4094e039d..2cdef65d31e1027dd724a83e4d3371f9ad22010a 100644 (file)
@@ -42,7 +42,7 @@ public class StartHtml5Drag extends TestBase {
         });
         addComponent(dropTarget);
 
-        Embedded iframe = new Embedded("", new ClassResource("html5drop.html",
+        Embedded iframe = new Embedded("", new ClassResource("html5drop.htm",
                 this));
         iframe.setType(Embedded.TYPE_BROWSER);
         iframe.setWidth(400, Sizeable.UNITS_PIXELS);
diff --git a/tests/testbench/com/vaadin/tests/dd/html5drop.htm b/tests/testbench/com/vaadin/tests/dd/html5drop.htm
new file mode 100644 (file)
index 0000000..ed05fce
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<script type="text/javascript">
+       if (window.addEventListener) {
+               window.addEventListener('load', init, false); //W3C
+       } else {
+               window.attachEvent('onload', init); //IE
+       }
+
+       function init(event) {
+               var el = document.getElementById("drop");
+               if (el.addEventListener) {
+                       el.addEventListener("dragover", dragover, false);
+                       el.addEventListener("dragenter", dragenter, false);
+                       el.addEventListener("drop", drop, false);
+               } else if (el.attachEvent) {
+                       el.attachEvent('ondragover', dragover);
+                       el.attachEvent('ondragenter', dragenter);
+                       el.attachEvent('ondrop', drop);
+               }
+       }
+
+       function dragover(event) {
+               event.dataTransfer.dropEffect = 'copy';
+        return cancel(event);
+       }
+
+       function drop(event) {
+               document.getElementById("drop").innerHTML = event.dataTransfer.getData('Text');
+        return cancel(event);
+       }
+
+       function dragenter(event) {
+               return cancel(event);
+       }
+
+       function cancel(event) {
+               if (event.preventDefault) {
+                       event.preventDefault();
+               }
+               return false;
+       }
+</script>
+</head>
+<body>
+       <div id="drop">or over here</div>
+</body>
+</html>
\ No newline at end of file