Bug 1776680 [wpt PR 34603] - [@container] Test invalidation of font-relative units...
[gecko.git] / dom / events / test / test_bug1264380.html
blob9349e9712fc683a2f5406409efae2f3779cf145a
1 <html>
2 <head>
3 <title>Test the dragstart event on the anchor in side shadow DOM</title>
4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script src="/tests/SimpleTest/EventUtils.js"></script>
7 <script>
9 async function runTests()
11 let dragService = SpecialPowers.Cc["@mozilla.org/widget/dragservice;1"].
12 getService(SpecialPowers.Ci.nsIDragService);
14 let iframe = document.querySelector("iframe");
15 let iframeDoc = iframe.contentDocument;
16 let iframeWin = iframe.contentWindow;
18 let shadow = iframeDoc.querySelector('#outer').attachShadow({mode: 'open'});
20 let target = iframeDoc.createElement('a');
21 target.textContent = "Drag me if you can!";
22 const URL = "http://www.mozilla.org/";
23 target.href = URL;
24 shadow.appendChild(target);
26 // Some of the drag data we don't actually care about for this test,
27 // so we'll use this comparator function to ignore them.
28 function ignoreFunc(actualData, expectedData) {
29 return true;
32 const EXPECTED_DRAG_DATA = [[{
33 type: "text/x-moz-url",
34 data: "",
35 eqTest: ignoreFunc,
36 }, {
37 type: "text/x-moz-url-data",
38 data: "",
39 eqTest: ignoreFunc,
40 }, {
41 type: "text/x-moz-url-desc",
42 data: "",
43 eqTest: ignoreFunc,
44 }, {
45 type: "text/uri-list",
46 data: URL,
47 }, {
48 type: "text/_moz_htmlinfo",
49 data: "",
50 eqTest: ignoreFunc,
51 }, {
52 type: "text/html",
53 data: "",
54 eqTest: ignoreFunc,
55 }, {
56 type: "text/plain",
57 data: URL,
58 }]];
60 let result = await synthesizePlainDragAndCancel(
62 srcElement: target,
63 srcWindow: iframeWin,
64 finalY: -10, // Avoid clicking the link
66 EXPECTED_DRAG_DATA);
67 ok(result === true, "Should have gotten the expected drag data.");
68 SimpleTest.finish();
72 SimpleTest.waitForExplicitFinish();
73 window.onload = () => {
74 SimpleTest.waitForFocus(runTests);
77 </script>
79 <body>
80 <iframe srcdoc='<div id="outer"/>'></iframe>
81 </body>
82 </html>