tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

015.html (2227B)


      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>Dropping image on horizontal scrollbar of a scrollable block element</title>
     10  <style type="text/css">
     11    div[ondragenter] {
     12      width: 3em;
     13      height: 3em;
     14      margin-top: 1em;
     15      font-size: 1.5em;
     16      white-space: nowrap;
     17      overflow-x: scroll;
     18    }
     19 
     20    p:first-child {
     21      padding-left: 1em;
     22    }
     23 
     24    img {
     25      width: 5px;
     26      height: 5px;
     27    }
     28  </style>
     29  <script>
     30    function checkImage(event) {
     31      document.querySelector('div').firstChild.nodeValue = (document.querySelector('img').getAttribute('src') == event
     32        .dataTransfer.getData('text/uri-list').replace(/\r\n$/, '')) ? 'PASS' : 'FAIL';
     33    }
     34  </script>
     35 </head>
     36 <body>
     37  <p><img
     38      src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEElEQVR42mNgaGD4D8YwBgAw9AX9Y9zBwwAAAABJRU5ErkJggg=="
     39      alt="PNG green pixel" ondragstart="event.dataTransfer.effectAllowed = 'copy'" /></p>
     40  <p>Drag little square above and drop it on scrollbar below. You should see word PASS when you drop it on scrollbar.
     41  </p>
     42  <div ondragenter="event.preventDefault()" ondragover="return false" ondrop="checkImage(event)">
     43    ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓</div>
     44  <script>
     45    async function test() {
     46      await new Promise(loaded => window.addEventListener("load", loaded));
     47 
     48      const img = document.querySelector('img');
     49      const div = document.querySelector('div');
     50 
     51      function onDropCallBack(event) {
     52        assert_equals(div.firstChild.nodeValue, 'PASS');
     53        return true;
     54      }
     55 
     56      dragDropTest(img, div, onDropCallBack,
     57        'Dragging the image to the horizontal scrollbar within a scrollable block element should copy it there',
     58        /*dragIframe=*/ null, /*dropIframe=*/ null, DropPosition.HORIZONTAL_SCROLLBAR);
     59    }
     60    test();
     61  </script>
     62 </body>
     63 </html>