Bug 1199729 - Part 5: Update tests for new DataTransfer behaviour, r=baku

This commit is contained in:
Michael Layzell 2017-09-06 11:38:30 -04:00
parent 63ecbc4c55
commit f09d1b11ca
4 changed files with 15 additions and 15 deletions

View File

@ -130,6 +130,9 @@
var dt = e.dataTransfer;
dragenterFired++;
// NOTE: This test is run with chrome privileges.
// For back-compat reasons, protected mode acts like readonly mode for
// chrome documents.
readOnly(e);
}

View File

@ -34,8 +34,8 @@ SimpleTest.waitForFocus(() => {
"clipboard contains html text");
window.addEventListener("paste", (e) => {
ok(e.clipboardData.types.indexOf('text/html'), -1, "clipboardData shouldn't have text/html");
ok(e.clipboardData.getData('text/plain'), "Formatted Text", "getData(text/plain) should return plain text");
is(e.clipboardData.types.indexOf('text/html'), -1, "clipboardData shouldn't have text/html");
is(e.clipboardData.getData('text/plain'), "Formatted Text", "getData(text/plain) should return plain text");
SimpleTest.finish();
});

View File

@ -74,7 +74,7 @@ function runTests()
SpecialPowers.addChromeEventListener("drop", chromeListener, true, false);
var targetNotHandling = document.getElementById("nothandling_target");
fireDrop(targetNotHandling, true, true);
fireDrop(targetNotHandling, false, true);
SpecialPowers.removeChromeEventListener("drop", chromeListener, true);
ok(chromeGotEvent, "Chrome should have got drop event!");
is(gGotHandlingDrop, false, "Didn't get drop on accepting element (2)");

View File

@ -659,22 +659,19 @@ function checkCachedDataTransfer(cd, eventtype)
setClipboardText("Some Clipboard Text");
var oldtext = cd.getData("text/plain");
ok(oldtext != "Some Clipboard Text", "clipboard get using " + testprefix);
ok(!oldtext, "clipboard get using " + testprefix);
var exh = false;
try { cd.mozSetDataAt("text/plain", "Test Cache Data", 0); } catch (ex) { exh = true; }
ok(eventtype == "paste" ? exh : !exh, "exception occured setting " + testprefix);
var newtext = (eventtype == "paste") ? cd.getData("text/plain") :
cd.mozGetDataAt("text/plain", 0);
is(newtext, (eventtype == "paste") ? oldtext : "Test Cache Data",
" clipboardData not changed using " + testprefix);
try {
cd.mozSetDataAt("text/plain", "Test Cache Data", 0);
} catch (ex) {}
ok(!cd.getData("text/plain"), "clipboard set using " + testprefix);
is(getClipboardText(), "Some Clipboard Text", "clipboard not changed using " + testprefix);
var exh = false;
try { cd.mozClearDataAt("text/plain", 0); } catch (ex) { exh = true; }
ok(eventtype == "paste" ? exh : !exh, "exception occured clearing " + testprefix);
try {
cd.mozClearDataAt("text/plain", 0);
} catch (ex) {}
ok(!cd.getData("text/plain"), "clipboard clear using " + testprefix);
is(getClipboardText(), "Some Clipboard Text", "clipboard not changed using " + testprefix);
}