Bug 725405 - Move the inline-output comment to the next line; r=msucan

This commit is contained in:
Spyros Livathinos 2012-02-24 10:41:06 -04:00
parent 0a31864e40
commit 318feb2866
4 changed files with 16 additions and 15 deletions

View File

@ -441,7 +441,8 @@ var Scratchpad = {
},
/**
* Write out a value at the current insertion point as a block comment
* Write out a value at the next line from the current insertion point.
* The comment block will always be preceded by a newline character.
* @param object aValue
* The Object to write out as a string
*/
@ -452,7 +453,7 @@ var Scratchpad = {
selection.end : // after selected text
this.editor.getCharCount(); // after text end
let newComment = "/*\n" + aValue + "\n*/";
let newComment = "\n/*\n" + aValue + "\n*/";
this.setText(newComment, insertionPoint, insertionPoint);

View File

@ -21,7 +21,7 @@ function runTests()
var scratchpad = gScratchpadWindow.Scratchpad;
var message = "\"Hello World!\""
var openComment = "/*\n";
var openComment = "\n/*\n";
var closeComment = "\n*/";
var error = "throw new Error(\"Ouch!\")";
let messageArray = {};

View File

@ -30,25 +30,25 @@ function verifyFalsies(sp)
{
sp.setText("undefined");
sp.display();
is(sp.selectedText, "/*\nundefined\n*/", "'undefined' is displayed");
is(sp.selectedText, "\n/*\nundefined\n*/", "'undefined' is displayed");
sp.setText("false");
sp.display();
is(sp.selectedText, "/*\nfalse\n*/", "'false' is displayed");
is(sp.selectedText, "\n/*\nfalse\n*/", "'false' is displayed");
sp.setText("0");
sp.display();
is(sp.selectedText, "/*\n0\n*/", "'0' is displayed");
is(sp.selectedText, "\n/*\n0\n*/", "'0' is displayed");
sp.setText("null");
sp.display();
is(sp.selectedText, "/*\nnull\n*/", "'null' is displayed");
is(sp.selectedText, "\n/*\nnull\n*/", "'null' is displayed");
sp.setText("NaN");
sp.display();
is(sp.selectedText, "/*\nNaN\n*/", "'NaN' is displayed");
is(sp.selectedText, "\n/*\nNaN\n*/", "'NaN' is displayed");
sp.setText("''");
sp.display();
is(sp.selectedText, "/*\n\n*/", "empty string is displayed");
is(sp.selectedText, "\n/*\n\n*/", "empty string is displayed");
}

View File

@ -40,13 +40,13 @@ function runTests()
is(content.wrappedJSObject.foobarBug636725, 3,
"display() updated window.foobarBug636725");
is(sp.getText(), "++window.foobarBug636725/*\n3\n*/",
is(sp.getText(), "++window.foobarBug636725\n/*\n3\n*/",
"display() shows evaluation result in the textbox");
is(sp.selectedText, "/*\n3\n*/", "selectedText is correct");
is(sp.selectedText, "\n/*\n3\n*/", "selectedText is correct");
let selection = sp.getSelectionRange();
is(selection.start, 24, "selection.start is correct");
is(selection.end, 31, "selection.end is correct");
is(selection.end, 32, "selection.end is correct");
// Test selection run() and display().
@ -94,16 +94,16 @@ function runTests()
"display() worked for the selected range");
is(sp.getText(), "window.foobarBug636725" +
"/*\na\n*/" +
"\n/*\na\n*/" +
" = 'c';\n" +
"window.foobarBug636725 = 'b';",
"display() shows evaluation result in the textbox");
is(sp.selectedText, "/*\na\n*/", "selectedText is correct");
is(sp.selectedText, "\n/*\na\n*/", "selectedText is correct");
selection = sp.getSelectionRange();
is(selection.start, 22, "selection.start is correct");
is(selection.end, 29, "selection.end is correct");
is(selection.end, 30, "selection.end is correct");
sp.deselect();