dwf/rva: adding optional element for DOM output

This commit is contained in:
pivotal
2008-12-04 11:43:22 -08:00
parent cc164257a7
commit e1cafe7881
4 changed files with 95 additions and 82 deletions

View File

@@ -1,5 +1,6 @@
JasmineReporters.JSON = function () {
JasmineReporters.JSON = function (elementId) {
var that = {
elementId: elementId,
results: {},
addResults: function (results) {
@@ -7,7 +8,15 @@ JasmineReporters.JSON = function () {
},
report: function () {
return Object.toJSON(that.results);
var output = Object.toJSON(that.results);
if (that.elementId) {
var element = document.getElementById(that.elementId);
if (element) {
element.innerHTML = output;
}
}
return output;
}
}
return that;