010.html (1464B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-vendor.js"></script> 6 <script src="/resources/testdriver-actions.js"></script> 7 <script src="../resources/test-helper.js"></script> 8 <head> 9 <title>Image drag and drop to iframe</title> 10 <style type="text/css"> 11 p:first-child { 12 padding-left: 20px; 13 } 14 15 iframe { 16 width: 160px; 17 height: 160px; 18 border-style: none; 19 } 20 </style> 21 </head> 22 <body> 23 <p><img src="../resources/circle.png" alt="PNG circle" ondragstart="event.dataTransfer.effectAllowed = 'copy'" /></p> 24 <p>Drag circle above to the box below. It should be copied to the box once you drop it there.</p> 25 <p><iframe src="helper-drop-image-here.xhtml">XHTML with image</iframe></p> 26 <script> 27 async function test() { 28 await new Promise(loaded => window.addEventListener("load", loaded)); 29 const img = document.querySelector('img'); 30 const iframe = document.querySelector('iframe'); 31 const div = frames[0].document.querySelector('div'); 32 33 function onDropCallBack(event) { 34 assert_equals(div.querySelector('img').src, img.src); 35 return true; 36 } 37 dragDropTest(img, div, onDropCallBack, 'Dragging an image to an iframe should copy it there', /*dragIframe=*/null, iframe) 38 }; 39 test(); 40 </script> 41 </body> 42 </html>