WebCore/manual-tests/drag-escape.html
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 <!DOCTYPE html>
       
     2 <html>
       
     3 <head>
       
     4 <script>
       
     5 
       
     6 var expectedEvents = ["dragstart", "dragend"];
       
     7 var i = 0;
       
     8 
       
     9 function recordEvent(e) {
       
    10     log(e.type);
       
    11     if (e.type !== expectedEvents[i]) {
       
    12         log("FAIL - expected " + expectedEvents[i] + " but got " + e.type);
       
    13     } else if (i == expectedEvents.length - 1) {
       
    14         log("SUCCESS");
       
    15     } else {
       
    16         i++;
       
    17     }
       
    18 }
       
    19 
       
    20 
       
    21 function log(msg) {
       
    22     var tn = document.createTextNode(msg + "\n");
       
    23     document.getElementById("log").appendChild(tn);
       
    24 }
       
    25 
       
    26 function dragStart(e) {
       
    27     recordEvent(e);
       
    28 }
       
    29 
       
    30 document.ondragend = function(e) {
       
    31     recordEvent(e);
       
    32 };
       
    33 
       
    34 document.ondrop = function(e) {
       
    35     log("FAIL - we should not get a " + e.type);
       
    36 };
       
    37 
       
    38 document.ondragenter = document.ondragover = function(e) {
       
    39     e.preventDefault();
       
    40 };
       
    41 
       
    42 
       
    43 </script>
       
    44 </head>
       
    45 <body>
       
    46     <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=26699">https://bugs.webkit.org/show_bug.cgi?id=26699</a></p>
       
    47 
       
    48     <p>Instructions: </p>
       
    49 
       
    50     <p>Drag the "Drag Me!" link below</p>
       
    51     <p>Press escape</p>
       
    52 
       
    53     <a id="test-link" href="http://webkit.org" ondragstart="dragStart(event)">Drag Me!</a>
       
    54 
       
    55     <pre id="log"></pre>
       
    56 </body>
       
    57 </html>