blob: 39679a546d90a3932430d601adc6fa0d020104bc (
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
46
47
48
49
50
51
52
53
54
|
<!DOCTYPE html>
<html>
<head>
<title>Test for nsIHTMLObjectResizer.hideResizers()</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none;">
</div>
<div id="editor" contenteditable></div>
<img src="green.png"><!-- for ensuring to load the image at first test of <img> case -->
<pre id="test">
<script class="testbody" type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async function() {
async function waitForSelectionChange() {
return new Promise(resolve => {
document.addEventListener("selectionchange", () => {
resolve();
}, {once: true});
});
}
document.execCommand("enableObjectResizing", false, true);
let editor = document.getElementById("editor");
editor.innerHTML = "<img id=\"target\" src=\"green.png\" width=\"100\" height=\"100\">";
let img = document.getElementById("target");
let promiseSelectionChangeEvent = waitForSelectionChange();
synthesizeMouseAtCenter(img, {});
await promiseSelectionChangeEvent;
ok(img.hasAttribute("_moz_resizing"), "resizers of the <img> should be visible");
getHTMLObjectResizer().hideResizers();
ok(!img.hasAttribute("_moz_resizing"), "resizers of the <img> should be hidden after a call of hideResizers()");
SimpleTest.finish();
});
function getHTMLObjectResizer() {
var Ci = SpecialPowers.Ci;
var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
return editingSession.getEditorForWindow(window).QueryInterface(Ci.nsIHTMLObjectResizer);
}
</script>
</pre>
</body>
</html>
|