diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/events/test/test_bug1264380.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/events/test/test_bug1264380.html')
-rw-r--r-- | dom/events/test/test_bug1264380.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/events/test/test_bug1264380.html b/dom/events/test/test_bug1264380.html new file mode 100644 index 000000000..76b9fb46b --- /dev/null +++ b/dom/events/test/test_bug1264380.html @@ -0,0 +1,54 @@ +<html> +<head> + <title>Test the dragstart event on the anchor in side shadow DOM</title> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> +<script> + +SimpleTest.waitForExplicitFinish(); + +SpecialPowers.pushPrefEnv({"set": [ + ["dom.webcomponents.enabled", true] +]}); + +function runTests() +{ + let dragService = SpecialPowers.Cc["@mozilla.org/widget/dragservice;1"]. + getService(SpecialPowers.Ci.nsIDragService); + + let shadow = document.querySelector('#outter').createShadowRoot(); + let target = document.createElement('a'); + let linkText = document.createTextNode("Drag me if you can!"); + target.appendChild(linkText); + target.href = "http://www.mozilla.org/"; + shadow.appendChild(target); + + let dataTransfer; + let trapDrag = function(event) { + ok(true, "Got dragstart event"); + dataTransfer = event.dataTransfer; + ok(dataTransfer, "DataTransfer object is available."); + is(dataTransfer.mozItemCount, 1, "initial link item count"); + is(dataTransfer.getData("text/uri-list"), "http://www.mozilla.org/", "link text/uri-list"); + is(dataTransfer.getData("text/plain"), "http://www.mozilla.org/", "link text/plain"); + } + + ok(!dragService.getCurrentSession(), "There shouldn't be a drag session!"); + window.addEventListener("dragstart", trapDrag, true); + synthesizeMouse(target, 2, 2, { type: "mousedown" }); + synthesizeMouse(target, 11, 11, { type: "mousemove" }); + synthesizeMouse(target, 20, 20, { type: "mousemove" }); + window.removeEventListener("dragstart", trapDrag, true); + ok(dragService.getCurrentSession(), "Drag session is available."); + dragService.endDragSession(false); + ok(!dragService.getCurrentSession(), "There shouldn't be a drag session anymore!"); + SimpleTest.finish(); +} + +</script> + +<body onload="window.setTimeout(runTests, 0);"> +<div id="outter"/> +</body> +</html> |