From 665c3e9f337b9cd288c9c9aa3798e5524b63969c Mon Sep 17 00:00:00 2001 From: pivotal Date: Fri, 5 Dec 2008 10:22:03 -0800 Subject: [PATCH] dwf/rva: moved JasmineReporter 'base class' to jasmine.js --- jasmine.iws | 88 ++++++++++++++++++++++---------------------- lib/jasmine.js | 38 ++++++++++++------- lib/json_reporter.js | 25 ------------- 3 files changed, 68 insertions(+), 83 deletions(-) diff --git a/jasmine.iws b/jasmine.iws index ab28ee2..fc12122 100644 --- a/jasmine.iws +++ b/jasmine.iws @@ -92,25 +92,25 @@ - + - + - + - + - + @@ -305,40 +305,6 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - + - + - + - + diff --git a/lib/jasmine.js b/lib/jasmine.js index efc9f30..dadd2ab 100755 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -304,27 +304,37 @@ var Jasmine = Runner(); var currentSuite; var currentSpec; +JasmineReporters.reporter = function (elementId) { + var that = { + element: document.getElementById(elementId), + output: '', + + addResults: function (results) { that.output = ''; }, + + addSpecResults: function (results) { that.output = ''; }, + + report: function () { + if (that.element) { + that.element.innerHTML += that.output; + } + return that.output; + } + } + + // TODO: throw if no element? + if (that.element) { + that.element.innerHTML = ''; + } + + return that; +} /* * TODO: - //* - add spec or description to results - //* - spec.execute needs to wait until the spec is done - //* - an async test will be killed after X ms if not done and then listed as failed with an "async fail" message of some sort - //* - Suite to run tests in order, constructed with a function called describe - * - Suite supports before - * - Suite supports after - //* - Suite supports beforeEach - //* - Suite supports afterEach - //* - Suite rolls up spec results - //* - Suite supports asynch - //* - Runner that runs suites in order - //* - Runner supports async * - HTML reporter * - Shows pass/fail progress (just like bootstrap reporter) * - Lists a Summary: total # specs, # of passed, # of failed * - Failed reports lists all specs that failed and what the failure was * - Failed output is styled with red - * - JSON reporter - * - Lists full results as a JSON object/string */ diff --git a/lib/json_reporter.js b/lib/json_reporter.js index cdacc46..b38baf5 100644 --- a/lib/json_reporter.js +++ b/lib/json_reporter.js @@ -1,28 +1,3 @@ -JasmineReporters.reporter = function (elementId) { - var that = { - element: document.getElementById(elementId), - output: '', - - addResults: function (results) { that.output = ''; }, - - addSpecResults: function (results) { that.output = ''; }, - - report: function () { - if (that.element) { - that.element.innerHTML += that.output; - } - return that.output; - } - } - - // TODO: throw if no element? - if (that.element) { - that.element.innerHTML = ''; - } - - return that; -} - JasmineReporters.JSON = function (elementId) { var that = JasmineReporters.reporter(elementId);