2008-12-04 20:54:54 +00:00
|
|
|
JasmineReporters.reporter = function (elementId) {
|
2008-12-04 18:56:58 +00:00
|
|
|
var that = {
|
2008-12-04 20:54:54 +00:00
|
|
|
element: document.getElementById(elementId),
|
|
|
|
output: '',
|
2008-12-04 18:56:58 +00:00
|
|
|
|
2008-12-04 20:54:54 +00:00
|
|
|
addResults: function (results) { that.output = ''; },
|
2008-12-04 18:56:58 +00:00
|
|
|
|
2008-12-04 20:54:54 +00:00
|
|
|
addSpecResults: function (results) { that.output = ''; },
|
2008-12-04 19:43:22 +00:00
|
|
|
|
2008-12-04 20:54:54 +00:00
|
|
|
report: function () {
|
|
|
|
if (that.element) {
|
|
|
|
that.element.innerHTML += that.output;
|
2008-12-04 19:43:22 +00:00
|
|
|
}
|
2008-12-04 20:54:54 +00:00
|
|
|
return that.output;
|
2008-12-04 18:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-04 20:54:54 +00:00
|
|
|
|
|
|
|
// TODO: throw if no element?
|
|
|
|
if (that.element) {
|
|
|
|
that.element.innerHTML = '';
|
|
|
|
}
|
|
|
|
|
2008-12-04 18:56:58 +00:00
|
|
|
return that;
|
|
|
|
}
|
|
|
|
|
2008-12-04 20:54:54 +00:00
|
|
|
JasmineReporters.JSON = function (elementId) {
|
|
|
|
var that = JasmineReporters.reporter(elementId);
|
|
|
|
|
|
|
|
that.addResults = function (results) {
|
|
|
|
that.output = Object.toJSON(results);
|
|
|
|
}
|
|
|
|
|
|
|
|
return that;
|
|
|
|
}
|
|
|
|
|
|
|
|
JasmineReporters.IncrementalJSON = function (elementId) {
|
|
|
|
var that = JasmineReporters.reporter(elementId);
|
|
|
|
|
|
|
|
that.addSpecResults = function (results) {
|
|
|
|
that.output = Object.toJSON(results);
|
|
|
|
}
|
|
|
|
|
|
|
|
return that;
|
|
|
|
}
|