Permalink
Browse files

fix issue #5628

  • Loading branch information...
1 parent 29aafda commit 36cdb68a96ee7f5de04734d497dc184bba1705fa @fflorent committed Jul 9, 2012
Showing with 47 additions and 11 deletions.
  1. +11 −0 extension/content/firebug/console/commandEditor.js
  2. +36 −11 tests/FBTest/content/FBTestFirebug.js
View
11 extension/content/firebug/console/commandEditor.js
@@ -254,6 +254,12 @@ Firebug.CommandEditor = Obj.extend(Firebug.Module,
}
},
+ focus: function()
+ {
+ if (this.editor)
+ this.editor.focus();
+ },
+
fontSizeAdjust: function(adjust)
{
if (!this.editor || !this.editor._view)
@@ -370,6 +376,11 @@ TextEditor.prototype =
return this.textBox.getAttribute("focused") == "true";
},
+ focus: function()
+ {
+ this.textBox.focus();
+ },
+
getSelectedText: function()
{
var start = this.textBox.selectionStart;
View
47 tests/FBTest/content/FBTestFirebug.js
@@ -1138,6 +1138,19 @@ this.getPref = function(pref)
// ********************************************************************************************* //
// Command Line
+function getCommandLine(useCommandEditor)
+{
+ return useCommandEditor ?
+ FW.Firebug.CommandEditor :
+ FW.Firebug.CommandLine.getSingleRowCommandLine();
+}
+
+/**
+ * executes an expression inside the Command Line
+ * @param {String} the command to execute
+ * @param {Object} the Firebug.chrome object
+ * @param {Boolean} if set to true, type in the CommandEditor, or in the CommandLine otherwise
+ */
this.executeCommand = function(expr, chrome, useCommandEditor)
{
this.clearAndTypeCommand(expr, useCommandEditor);
@@ -1148,39 +1161,51 @@ this.executeCommand = function(expr, chrome, useCommandEditor)
FBTest.sendKey("RETURN", "fbCommandLine");
};
-this.clearCommand = function(useCommandEditor)
+/**
+ * clears the Command Line or the Command Editor
+ */
+this.clearCommand = function()
{
- var doc = FW.Firebug.chrome.window.document;
- var cmdLine = doc.getElementById(useCommandEditor ? "fbCommandEditor": "fbCommandLine");
- cmdLine.value = "";
+ FW.Firebug.CommandLine.clear(FW.Firebug.currentContext);
};
+
+/**
+ * clears and types a command into the Command Line or the Command Editor
+ * @param {String} the command to type
+ * @param {Boolean} if set to true, type in the CommandEditor, or in the CommandLine otherwise
+ *
+ */
this.clearAndTypeCommand = function(string, useCommandEditor)
{
- FBTest.clearCommand(useCommandEditor);
+ FBTest.clearCommand();
FBTest.typeCommand(string, useCommandEditor);
};
+/**
+ * types a command into the Command Line or the Command Editor
+ * @param {String} the command to type
+ * @param {Boolean} if set to true, type in the CommandEditor, or in the CommandLine otherwise
+ *
+ */
this.typeCommand = function(string, useCommandEditor)
{
var doc = FW.Firebug.chrome.window.document;
- var cmdLine = doc.getElementById(useCommandEditor ? "fbCommandEditor": "fbCommandLine");
var panelBar1 = doc.getElementById("fbPanelBar1");
+ var cmdLine = getCommandLine(useCommandEditor);
var win = panelBar1.browser.contentWindow;
- if (useCommandEditor)
- FBTest.setPref("largeCommandLine", useCommandEditor);
+ FBTest.setPref("commandEditor", useCommandEditor);
FW.Firebug.chrome.window.focus();
panelBar1.browser.contentWindow.focus();
- FBTest.focus(cmdLine);
+ cmdLine.focus();
FBTest.sysout("typing "+string+" in to "+cmdLine+" focused on "+
FW.FBL.getElementCSSSelector(doc.commandDispatcher.focusedElement)+
" win "+panelBar1.browser.contentWindow);
- for (var i=0; i<string.length; ++i)
- FBTest.synthesizeKey(string.charAt(i), null, win);
+ this.sendString(string, doc.commandDispatcher.focusedElement);
};
/**

0 comments on commit 36cdb68

Please sign in to comment.