4 <title>Test for nsIHTMLObjectResizer.hideResizers()
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <div id=
"content" style=
"display: none;">
15 <div id=
"editor" contenteditable
></div>
16 <img src=
"green.png"><!-- for ensuring to load the image at first test of <img> case -->
19 <script class=
"testbody" type=
"application/javascript">
22 SimpleTest.waitForExplicitFinish();
23 SimpleTest.waitForFocus(async function() {
24 async function waitForSelectionChange() {
25 return new Promise(resolve =
> {
26 document.addEventListener(
"selectionchange", () =
> {
32 document.execCommand(
"enableObjectResizing", false, true);
33 let editor = document.getElementById(
"editor");
34 editor.innerHTML =
"<img id=\"target\
" src=\"green.png\
" width=\"100\
" height=\"100\
">";
35 let img = document.getElementById(
"target");
36 let promiseSelectionChangeEvent = waitForSelectionChange();
37 synthesizeMouseAtCenter(img, {});
38 await promiseSelectionChangeEvent;
39 ok(img.hasAttribute(
"_moz_resizing"),
"resizers of the <img> should be visible");
40 getHTMLObjectResizer().hideResizers();
41 ok(!img.hasAttribute(
"_moz_resizing"),
"resizers of the <img> should be hidden after a call of hideResizers()");
46 function getHTMLObjectResizer() {
47 var Ci = SpecialPowers.Ci;
48 var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
49 return editingSession.getEditorForWindow(window).QueryInterface(Ci.nsIHTMLObjectResizer);