dndTransferCases-manual.html (2263B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset='utf-8'> 5 <title>HTML Test: dropzone_attribute_data_item_kind_string</title> 6 <link rel='author' title='Intel' href='http://www.intel.com'> 7 <link rel='author' title='Domenic Denicola' href='mailto:d@domenic.com'> 8 <link rel='help' href='https://html.spec.whatwg.org/multipage/#the-datatransfer-interface'> 9 <script src='/resources/testharness.js'></script> 10 <script src='/resources/testharnessreport.js'></script> 11 <style> 12 #drop { 13 border: 2px solid black; 14 width: 100px; 15 height: 100px; 16 padding: 20px; 17 } 18 #drag { 19 color: blue; 20 margin: 20px auto; 21 } 22 </style> 23 </head> 24 25 <body> 26 <div>Select and drag the blue text to rectangular box.</div> 27 <div id='drag' draggable>blue text</div> 28 <div id='drop' dropzone='copy string:text/plain'></div> 29 <div id='log'> </div> 30 31 <script> 32 var drag; 33 setup(function() { 34 drag = document.querySelector('#drag'); 35 }, {explicit_done: true, explicit_timeout: true}); 36 37 on_event(drag, 'dragstart', function(event) { 38 test(function() { 39 assert_equals(event.dataTransfer.effectAllowed, 'uninitialized'); 40 }, 'effectAllowed should be "uninitialized"'); 41 42 test(function() { 43 assert_equals(event.dataTransfer.types.constructor, Array, 'should be an array'); 44 assert_true(Object.isFrozen(event.dataTransfer.types), 'should be frozen'); 45 }, 'types should be a frozen array'); 46 47 test(function() { 48 assert_false('contains' in event.dataTransfer.types); 49 assert_false('item' in event.dataTransfer.types); 50 }, 'types should not have any of the historical methods'); 51 52 test(function() { 53 assert_equals(event.dataTransfer.types, event.dataTransfer.types); 54 }, 'types should return the same object from multiple reads (assuming no changes)'); 55 56 test(function() { 57 var before = event.dataTransfer.types; 58 event.dataTransfer.clearData(); 59 assert_not_equals(event.dataTransfer.types, before); 60 }, 'types should return a different object after changes'); 61 62 done(); 63 }); 64 </script> 65 </body> 66 </html>