summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/the-dropzone-attribute/dropzone_attribute_link_element-manual.html
blob: c6e5756ad6823fa0c9ad304b25d35a9850a4648f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <title>HTML Test: dropzone_attribute_element_link</title>
    <link rel='author' title='Intel' href='http://www.intel.com'>
    <link rel='help' href='https://html.spec.whatwg.org/multipage/#the-dropzone-attribute'>
    <script src='/resources/testharness.js'></script>
    <script src='/resources/testharnessreport.js'></script>
    <style>
      #drop {
        border: 2px solid black;
        width: 100px;
        height: 100px;
        padding: 20px;
      }
      div { margin: 20px 0px;}
    </style>
  </head>

  <body>
    <div>Select and drag the all the text of link below to rectangular box.</div>
    <a href="http://w3.org" title="World Wide Web Consortium">w3.org</a>
    <div id='drop' dropzone='link string:text/plain'></div>
    <div id='log'> </div>

    <script>
      var drop;
      setup(function() {
          drop = document.querySelector('#drop');
      }, {explicit_done: true, explicit_timeout: true});

      on_event(drop, 'drop', function(event) {

        test(function() {
          assert_equals(event.dataTransfer.dropEffect, 'link',  'dropzone content attribute value is "link"');
        }, 'dropzone content attribute value is "link"');

        test(function() {
          var item = item = event.dataTransfer.items[0];
          assert_equals(event.dataTransfer.getData(item.type), 'w3.org',  'The dropped link value is "w3.org"');
        }, 'The dropped link value is "w3.org"');

        done();
      });
    </script>
  </body>
</html>