From 318feb2866969dfc8286bd493c894b6107c5e80b Mon Sep 17 00:00:00 2001 From: Spyros Livathinos Date: Fri, 24 Feb 2012 10:41:06 -0400 Subject: [PATCH] Bug 725405 - Move the inline-output comment to the next line; r=msucan --- browser/devtools/scratchpad/scratchpad.js | 5 +++-- ...er_scratchpad_bug690552_display_outputs_errors.js | 2 +- .../test/browser_scratchpad_bug_679467_falsy.js | 12 ++++++------ .../test/browser_scratchpad_execute_print.js | 12 ++++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js index 93634beeea7..025d1d4e07a 100644 --- a/browser/devtools/scratchpad/scratchpad.js +++ b/browser/devtools/scratchpad/scratchpad.js @@ -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); diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js index 760d4cdd5f0..f1c942aa5c9 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js @@ -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 = {}; diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js index e19754fb4f2..e23103a9be2 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js @@ -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"); } diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js b/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js index 5278fcffc32..f1c24766028 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js @@ -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();