summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/target-origin/001-manual.html
blob: ff8572e937bff4fd2761d801ef3bd648d395ba12 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!doctype html>
<html>
  <head>
    <title>allowTargetOrigin syntax</title>
    <style type="text/css">
blockquote { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; }
    </style>
    <script type="text/javascript" src="/resources/testharness.js"></script>
    <script type="text/javascript" src="/resources/testharnessreport.js"></script>
    <script type="text/javascript">
setup(function () {},{explicit_done:true});
window.onload = function () {
  document.getElementsByTagName('blockquote')[0].ondragstart = function (e) {
    test(function() {
      assert_true( !!e.dataTransfer.allowTargetOrigin );
    }, 'allowTargetOrigin should be supported' );
    test(function() {
      assert_throws_js( TypeError, function () { e.dataTransfer.allowTargetOrigin(); } );
    }, 'no parameter should throw TypeError' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin(''); } );
    }, 'empty string should be an invalid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('*');
    }, '* should be a valid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('/');
    }, '/ should be a valid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('/foo'); } );
    }, '/foo should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('foo'); } );
    }, 'foo should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('//foo'); } );
    }, '//foo should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://'); } );
    }, 'http:// should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://*'); } );
    }, 'http://* should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo*'); } );
    }, 'http://foo* should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo.*'); } );
    }, 'http://foo.* should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://*.foo'); } );
    }, 'http://*.foo should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo:bar'); } );
    }, 'http://foo:bar should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('http://foo:bar@'); } );
    }, 'http://foo:bar@ should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file:'); } );
    }, 'file: should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file://'); } );
    }, 'file:// should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('data:'); } );
    }, 'data: should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('data:text/html'); } );
    }, 'data:text/html should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file://localhost/'); } );
    }, 'file://localhost/ should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('file:///'); } );
    }, 'file:/// should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('data:text/html,'); } );
    }, 'data:text/html, should be an invalid URL' );
    test(function() {
      assert_throws_dom( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin('javascript:'); } );
    }, 'javascript: should be an invalid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('http://foo');
    }, 'http://foo should be a valid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('http://foo.bar');
    }, 'http://foo.bar should be a valid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('http://foo/bar');
    }, 'http://foo/bar should be a valid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('http://foo:123');
    }, 'http://foo:123 should be a valid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('http://foo:bar@baz');
    }, 'http://foo:bar@baz should be a valid URL' );
    test(function() {
      e.dataTransfer.allowTargetOrigin('http://foo:bar@baz:123/qux');
    }, 'http://foo:bar@baz:123/qux should be a valid URL' );
    done();
  };
};
    </script>
  </head>
  <body>
    <blockquote draggable="true"></blockquote>
    <div id="log">Drag the orange square above until the drag placeholder appears, then release it.</div>
    <noscript><p>Enable JavaScript and reload</p></noscript>
  </body>
</html>