mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
Bug 1199729 - Part 5: Update tests for new DataTransfer behaviour, r=baku
This commit is contained in:
parent
63ecbc4c55
commit
f09d1b11ca
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
@ -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)");
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user