Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New API for message logging: fireunit.log(msg); Contribution by Shane…

… Tomlinson.
  • Loading branch information...
commit 9429805af2aac4468c57595fd16a84bccf53479f 1 parent f8cd28b
@janodvarko janodvarko authored
View
41 chrome/content/fireunit/fireunit.js
@@ -442,6 +442,20 @@ FBL.ns(function() { with (FBL) {
panel.appendResults([result]);
}
},
+
+ /*
+ * Inserts a log message
+ * @param {String} msg The message to display.
+ */
+ log: function( msg ) {
+ var result = new Firebug.FireUnitModule.TestResult(win, undefined, msg, undefined, undefined, true);
+ if ( testQueue ) {
+ queueResults.push(result);
+ } else {
+ var panel = context.getPanel(panelName);
+ panel.appendResults([result]);
+ }
+ },
/*
* Compares two strings to see if they are the same. If they are,
@@ -667,7 +681,7 @@ FBL.ns(function() { with (FBL) {
if (FBTrace.DBG_FIREUNIT)
FBTrace.sysout("fireunit.FireUnitPanel.updateOption: " + name + ": " + value);
- if (name == "fireunit.showPass" || name == "fireunit.showFail")
+ if (name == "fireunit.showPass" || name == "fireunit.showFail" || name == "fireunit.showLog" )
this.updatePanelFilter();
},
@@ -675,6 +689,7 @@ FBL.ns(function() { with (FBL) {
{
var showPass = Firebug.getPref(Firebug.prefDomain, "fireunit.showPass");
var showFail = Firebug.getPref(Firebug.prefDomain, "fireunit.showFail");
+ var showLog = Firebug.getPref(Firebug.prefDomain, "fireunit.showLog");
// Update styles on the root table (contains the list of results).
// These styles ensure proper visibility of pass and fail tests according
@@ -683,6 +698,7 @@ FBL.ns(function() { with (FBL) {
var table = getElementByClass(panelNode, "testTable");
showPass ? setClass(table, "showPass") : removeClass(table, "showPass");
showFail ? setClass(table, "showFail") : removeClass(table, "showFail");
+ showLog ? setClass(table, "showLog") : removeClass(table, "showLog");
},
getOptionsMenuItems: function(context)
@@ -690,6 +706,7 @@ FBL.ns(function() { with (FBL) {
var items = [];
items.push(this.optionMenu($FU_STR("fireunit.option.Passing Tests"), "fireunit.showPass"));
items.push(this.optionMenu($FU_STR("fireunit.option.Failing Tests"), "fireunit.showFail"));
+ items.push(this.optionMenu($FU_STR("fireunit.option.Log"), "fireunit.showLog"));
items.push("-");
items.push({
label: $FU_STR("fireunit.option.Enable Privileges"),
@@ -744,7 +761,7 @@ FBL.ns(function() { with (FBL) {
var summary = { passing: 0, failing: 0 };
for (var row = tbody.firstChild; row; row = row.nextSibling) {
if (hasClass(row, "testResultRow"))
- hasClass(row, "testError") ? summary.failing++ : summary.passing++;
+ hasClass(row, "testError") ? summary.failing++ : hasClass(row, "testOK") ? summary.passing++ : true;
}
// Append summary row.
@@ -777,7 +794,8 @@ FBL.ns(function() { with (FBL) {
FOR("result", "$results",
TR({"class": "testResultRow", _repObject: "$result",
$testError: "$result|isError",
- $testOK: "$result|isOK"},
+ $testOK: "$result|isOK",
+ $testLog: "$result|isLog"},
TD({"class": "testResultCol", width: "100%"},
DIV({"class": "testResultMessage testResultLabel"},
"$result|getMessage"
@@ -823,13 +841,18 @@ FBL.ns(function() { with (FBL) {
},
isError: function(result)
- {
- return !result.pass;
+ { // result.log takes precedence
+ return !result.log && !result.pass;
},
isOK: function(result)
+ { // result.log takes precedence
+ return !result.log && result.pass;
+ },
+
+ isLog: function(result)
{
- return result.pass;
+ return result.log;
},
summaryPassed: function(summary)
@@ -1266,12 +1289,14 @@ FBL.ns(function() { with (FBL) {
/**
* This object represents a test-result.
*/
- Firebug.FireUnitModule.TestResult = function(win, pass, msg, expected, result)
+ Firebug.FireUnitModule.TestResult = function(win, pass, msg, expected, result, log)
{
var location = win.location.href;
this.fileName = location.substr(location.lastIndexOf("/") + 1);
- this.pass = pass ? true : false;
+ this.pass = pass;
+ this.log = log;
+
this.msg = clean(msg);
this.expected = expected;
this.result = result;
View
37 chrome/locale/en-US/fireunit.properties
@@ -1,18 +1,19 @@
-fireunit.panel.Test=Test
-fireunit.tab.Stack=Test Location
-fireunit.tab.Compare=Compare
-fireunit.title.Expected=Expected Result
-fireunit.title.Result=Actual Result
-fireunit.title.Difference=Difference
-fireunit.switch.view_source=view source
-fireunit.switch.pretty_print=pretty print
-fireunit.option.Passing_Tests=Passing Tests
-fireunit.option.Failing_Tests=Failing Tests
-fireunit.option.Enable_Privileges=Enable Privileges
-fireunit.item.View_Source=View Source
-fireunit.item.Copy=Copy
-fireunit.item.Copy_All=Copy All
-fireunit.test.Line=Line
-fireunit.label.Pass=Pass
-fireunit.label.Fail=Fail
-fireunit.label.Timeout=Timeout
+fireunit.panel.Test=Test
+fireunit.tab.Stack=Test Location
+fireunit.tab.Compare=Compare
+fireunit.title.Expected=Expected Result
+fireunit.title.Result=Actual Result
+fireunit.title.Difference=Difference
+fireunit.switch.view_source=view source
+fireunit.switch.pretty_print=pretty print
+fireunit.option.Passing_Tests=Passing Tests
+fireunit.option.Failing_Tests=Failing Tests
+fireunit.option.Log=Log
+fireunit.option.Enable_Privileges=Enable Privileges
+fireunit.item.View_Source=View Source
+fireunit.item.Copy=Copy
+fireunit.item.Copy_All=Copy All
+fireunit.test.Line=Line
+fireunit.label.Pass=Pass
+fireunit.label.Fail=Fail
+fireunit.label.Timeout=Timeout
View
9 chrome/skin/classic/fireunit.css
@@ -94,6 +94,10 @@
display: table-row !important;
}
+.testTable.showLog .testResultRow.testLog {
+ display: table-row !important;
+}
+
.testTable.showPass .testResultRow.testOK {
display: table-row !important;
}
@@ -123,6 +127,11 @@
padding-left: 18px;
}
+.testResultRow.testLog
+{
+ color: Blue;
+}
+
.summaryPass.testResultSummaryLabel {
color: Green;
}
View
13 defaults/preferences/prefs.js
@@ -1,6 +1,7 @@
-pref("extensions.firebug.fireunit.showPass", true);
-pref("extensions.firebug.fireunit.showFail", true);
-pref("extensions.firebug.fireunit.testTimeout", 0); // Break timeout for stuck unit test. Disabled by default.
-
-// Support for tracing console
-pref("extensions.firebug.DBG_FIREUNIT", false);
+pref("extensions.firebug.fireunit.showPass", true);
+pref("extensions.firebug.fireunit.showFail", true);
+pref("extensions.firebug.fireunit.showLog", true);
+pref("extensions.firebug.fireunit.testTimeout", 0); // Break timeout for stuck unit test. Disabled by default.
+
+// Support for tracing console
+pref("extensions.firebug.DBG_FIREUNIT", false);
Please sign in to comment.
Something went wrong with that request. Please try again.