summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html')
-rw-r--r--testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html b/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html
new file mode 100644
index 000000000..e0302712e
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/target-origin/011-manual.html
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+ <head>
+ <title>allowTargetOrigin should only block dragenter, dragover, dragleave and drop events</title>
+ <style type="text/css">
+div { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; float: left; }
+div + div { background: blue; }
+ </style>
+ <script type="text/javascript">
+window.onload = function () {
+ var orange = document.getElementsByTagName('div')[0], evtdone = {}, fails = [];
+ orange.ondragstart = function (e) {
+ evtdone[e.type] = true;
+ e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.setData('text','dummy text');
+ try {
+ e.dataTransfer.allowTargetOrigin('http://example.com');
+ } catch(e) {
+ fails[fails.length] = 'allowTargetOrigin threw an error: '+e;
+ }
+ };
+ orange.ondragenter = orange.ondragover = orange.ondrop = function (e) {
+ e.preventDefault();
+ evtdone[e.type] = true;
+ };
+ orange.ondrag = orange.ondragleave = function (e) {
+ evtdone[e.type] = true;
+ };
+ orange.ondragend = function (e) {
+ evtdone[e.type] = true;
+ if( !evtdone.dragstart ) {
+ fails[fails.length] = 'dragstart did not fire - how did that happen?';
+ }
+ if( !evtdone.drag ) {
+ fails[fails.length] = 'drag did not fire';
+ }
+ if( !evtdone.dragend ) {
+ fails[fails.length] = 'dragend did not fire - OK, who broke the testcase?';
+ }
+ if( evtdone.dragenter ) {
+ fails[fails.length] = 'dragenter fired';
+ }
+ if( evtdone.dragover ) {
+ fails[fails.length] = 'dragover fired';
+ }
+ if( evtdone.dragleave ) {
+ fails[fails.length] = 'dragleave fired';
+ }
+ if( evtdone.drop ) {
+ fails[fails.length] = 'drop fired';
+ }
+ document.getElementsByTagName('p')[0].innerHTML = fails.length ? ( 'FAIL:<br>' + fails.join('<br>') ) : 'PASS';
+ };
+};
+ </script>
+ </head>
+ <body>
+ <p>Drag the orange square over the blue square then back to the orange square, then release it. Fail if this text does not change.</p>
+ <div draggable="true"></div>
+ <div></div>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ </body>
+</html> \ No newline at end of file