2011-05-17 07:39:59 -07:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
2012-03-24 04:34:42 -07:00
|
|
|
const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642615";
|
2011-05-17 07:39:59 -07:00
|
|
|
|
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper",
|
|
|
|
"@mozilla.org/widget/clipboardhelper;1",
|
|
|
|
"nsIClipboardHelper");
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
function consoleOpened(HUD) {
|
2011-05-17 07:39:59 -07:00
|
|
|
let jsterm = HUD.jsterm;
|
|
|
|
let stringToCopy = "foobazbarBug642615";
|
|
|
|
|
|
|
|
jsterm.clearOutput();
|
|
|
|
|
2011-05-17 08:07:33 -07:00
|
|
|
ok(!jsterm.completeNode.value, "no completeNode.value");
|
2011-05-17 07:39:59 -07:00
|
|
|
|
|
|
|
jsterm.setInputValue("doc");
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
let completionValue;
|
2012-05-25 06:44:17 -07:00
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
// wait for key "u"
|
|
|
|
function onCompletionValue() {
|
|
|
|
completionValue = jsterm.completeNode.value;
|
2011-05-17 07:39:59 -07:00
|
|
|
|
|
|
|
// Arguments: expected, setup, success, failure.
|
|
|
|
waitForClipboard(
|
|
|
|
stringToCopy,
|
|
|
|
function() {
|
2012-04-16 19:14:01 -07:00
|
|
|
clipboardHelper.copyString(stringToCopy, document);
|
2011-05-17 07:39:59 -07:00
|
|
|
},
|
2012-05-25 03:28:47 -07:00
|
|
|
onClipboardCopy,
|
|
|
|
finishTest);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onClipboardCopy() {
|
|
|
|
updateEditUIVisibility();
|
|
|
|
goDoCommand("cmd_paste");
|
|
|
|
|
|
|
|
waitForSuccess(waitForPaste);
|
|
|
|
}
|
|
|
|
|
|
|
|
let waitForPaste = {
|
|
|
|
name: "no completion value after paste",
|
|
|
|
validatorFn: function()
|
|
|
|
{
|
|
|
|
return !jsterm.completeNode.value;
|
|
|
|
},
|
|
|
|
successFn: onClipboardPaste,
|
|
|
|
failureFn: finishTest,
|
|
|
|
};
|
|
|
|
|
|
|
|
function onClipboardPaste() {
|
|
|
|
goDoCommand("cmd_undo");
|
|
|
|
waitForSuccess({
|
|
|
|
name: "completion value for 'docu' after undo",
|
|
|
|
validatorFn: function()
|
|
|
|
{
|
|
|
|
return !!jsterm.completeNode.value;
|
2012-05-25 03:28:47 -07:00
|
|
|
},
|
2012-05-25 03:28:47 -07:00
|
|
|
successFn: onCompletionValueAfterUndo,
|
|
|
|
failureFn: finishTest,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function onCompletionValueAfterUndo() {
|
|
|
|
is(jsterm.completeNode.value, completionValue,
|
|
|
|
"same completeNode.value after undo");
|
|
|
|
|
|
|
|
EventUtils.synthesizeKey("v", {accelKey: true});
|
|
|
|
waitForSuccess({
|
|
|
|
name: "no completion after ctrl-v (paste)",
|
|
|
|
validatorFn: function()
|
|
|
|
{
|
|
|
|
return !jsterm.completeNode.value;
|
|
|
|
},
|
|
|
|
successFn: finishTest,
|
|
|
|
failureFn: finishTest,
|
|
|
|
});
|
|
|
|
}
|
2011-05-17 07:39:59 -07:00
|
|
|
|
|
|
|
EventUtils.synthesizeKey("u", {});
|
2012-05-25 03:28:47 -07:00
|
|
|
|
|
|
|
waitForSuccess({
|
|
|
|
name: "completion value for 'docu'",
|
|
|
|
validatorFn: function()
|
|
|
|
{
|
|
|
|
return !!jsterm.completeNode.value;
|
|
|
|
},
|
|
|
|
successFn: onCompletionValue,
|
|
|
|
failureFn: finishTest,
|
|
|
|
});
|
2011-05-17 07:39:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
addTab(TEST_URI);
|
2012-05-25 03:28:47 -07:00
|
|
|
browser.addEventListener("load", function onLoad() {
|
|
|
|
browser.removeEventListener("load", onLoad, true);
|
|
|
|
openConsole(null, consoleOpened);
|
|
|
|
}, true);
|
2011-05-17 07:39:59 -07:00
|
|
|
}
|