зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1485925 - part 0: Add automated test for nsIHTMLObjectResizer_hideResizers.html r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D4922 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3e09e244fd
Коммит
c4c2c747a5
|
@ -285,6 +285,7 @@ skip-if = android_version == '24'
|
|||
[test_nsIHTMLEditor_getSelectedElement.html]
|
||||
[test_nsIHTMLEditor_selectElement.html]
|
||||
[test_nsIHTMLEditor_setCaretAfterElement.html]
|
||||
[test_nsIHTMLObjectResizer_hideResizers.html]
|
||||
[test_nsITableEditor_getCellAt.html]
|
||||
[test_nsITableEditor_getCellIndexes.html]
|
||||
[test_nsITableEditor_getFirstRow.html]
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for nsIHTMLObjectResizer.hideResizers()</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" 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>
|
Загрузка…
Ссылка в новой задаче