Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug1574596.html
blobfe0a090d26d0db9d1ce124d95907d1fac1ab4940
1 <!DOCTYPE html>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1574596
5 -->
6 <head>
7 <title>Test for Bug 1574596</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script src="/tests/SimpleTest/EventUtils.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 <script>
13 add_task(async function() {
14 let iframe = document.getElementById("iframe1");
15 iframe.focus();
16 let edit = iframe.contentDocument.getElementById("edit");
17 edit.focus();
19 iframe.contentDocument.execCommand("enableObjectResizing", false, true);
21 async function waitForSelectionChange() {
22 return new Promise(resolve => {
23 iframe.contentDocument.addEventListener("selectionchange", () => {
24 resolve();
25 }, {once: true});
26 });
29 let target = iframe.contentDocument.getElementById("target");
30 let promiseSelectionChangeEvent = waitForSelectionChange();
31 synthesizeMouseAtCenter(target, {}, iframe.contentWindow);
32 await promiseSelectionChangeEvent;
34 ok(target.hasAttribute("_moz_resizing"),
35 "resizers of the <img> should be visible");
37 iframe.style.display = "none";
38 iframe.offsetHeight; // reflow
40 await new Promise(SimpleTest.executeSoon);
41 ok(!target.hasAttribute("_moz_resizing"),
42 "resizers of the <img> should be hidden");
44 iframe.style.display = "";
45 iframe.offsetHeight; // reflow
47 promiseSelectionChangeEvent = waitForSelectionChange();
48 synthesizeMouseAtCenter(target, {}, iframe.contentWindow);
49 await promiseSelectionChangeEvent;
51 ok(target.hasAttribute("_moz_resizing"),
52 "resizers of the <img> should be visible again");
53 });
54 </script>
55 </head>
56 <body>
57 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1574596">Mozilla Bug 1574596</a>
58 <p id="display"></p>
60 <div>
61 <iframe id="iframe1" srcdoc="<div id=edit contenteditable><img id='target' src='green.png'></div>"></iframe>
62 </div>
63 </body>
64 </html>