summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/events/historical-manual.html
blob: 0e2147222d9435793374e37bdf1cb49796749711 (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
<!DOCTYPE html>
<title>Historical drag-and-drop features</title>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
.test-square {
  width: 100px;
  height: 100px;
}

#draggable {
  background: orange;
}

#dropzone {
  background: blue;
}
</style>

<p>Drag the orange square onto the blue square and release it.</p>

<div draggable="true" id="draggable" class="test-square" ondragstart="event.dataTransfer.setData('text/plain', null)"></div>
<div id="dropzone" class="test-square"></div>

<script>
"use strict";

async_test(t => {
  let dragexitCount = 0;
  document.addEventListener("dragexit", () => {
    ++dragexitCount;
  });

  // Prevent the event to allow drop
  document.addEventListener("dragover", e => {
    e.preventDefault();
  });

  document.addEventListener("drop", t.step_func_done(() => {
    assert_equals(dragexitCount, 0);
  }));
}, `dragexit must not fire during drag-and-drop`);
</script>