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
Родитель bdb4b74e9a
Коммит 2255d49131
4 изменённых файлов: 16 добавлений и 15 удалений

Просмотреть файл

@ -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 * @param object aValue
* The Object to write out as a string * The Object to write out as a string
*/ */
@ -452,7 +453,7 @@ var Scratchpad = {
selection.end : // after selected text selection.end : // after selected text
this.editor.getCharCount(); // after text end this.editor.getCharCount(); // after text end
let newComment = "/*\n" + aValue + "\n*/"; let newComment = "\n/*\n" + aValue + "\n*/";
this.setText(newComment, insertionPoint, insertionPoint); this.setText(newComment, insertionPoint, insertionPoint);

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -40,13 +40,13 @@ function runTests()
is(content.wrappedJSObject.foobarBug636725, 3, is(content.wrappedJSObject.foobarBug636725, 3,
"display() updated window.foobarBug636725"); "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"); "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(); let selection = sp.getSelectionRange();
is(selection.start, 24, "selection.start is correct"); 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(). // Test selection run() and display().
@ -94,16 +94,16 @@ function runTests()
"display() worked for the selected range"); "display() worked for the selected range");
is(sp.getText(), "window.foobarBug636725" + is(sp.getText(), "window.foobarBug636725" +
"/*\na\n*/" + "\n/*\na\n*/" +
" = 'c';\n" + " = 'c';\n" +
"window.foobarBug636725 = 'b';", "window.foobarBug636725 = 'b';",
"display() shows evaluation result in the textbox"); "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(); selection = sp.getSelectionRange();
is(selection.start, 22, "selection.start is correct"); 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(); sp.deselect();