From b9b4648a2465047a66339b519f7df0594a8aca8c Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 11 Jan 2012 11:37:25 -0500 Subject: [PATCH] update reporter --- .../jasmine.HeadlessReporter.Verbose.coffee | 25 +++++++++++++-- .../jasmine.HeadlessReporter.Verbose.js | 32 ++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee index 15551a9..51028f8 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee +++ b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee @@ -16,11 +16,30 @@ class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleB indentSpec: (current, last, color) => last = last.slice(0) + lines = [] + + for name in current + if last.shift() != name + lines.push(name) + else + lines.push(null) + + this.indentLines(lines, color) + + indentLines: (lines, color) => + indent = '' + output = [] - indent = '' - for name in current - output.push(indent + name.foreground(color)) if last.shift() != name + for line in lines + if line? + outputLine = indent + outputLine += this.colorLine(line, color) + + output.push(outputLine) indent += ' ' output + + colorLine: (line, color) => + line.foreground(color) diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js index 4840916..19e27b4 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js @@ -6,6 +6,8 @@ __extends(Verbose, jasmine.HeadlessReporter.ConsoleBase); function Verbose() { + this.colorLine = __bind(this.colorLine, this); + this.indentLines = __bind(this.indentLines, this); this.indentSpec = __bind(this.indentSpec, this); this.displaySpec = __bind(this.displaySpec, this); this.displayFailure = __bind(this.displayFailure, this); @@ -29,18 +31,40 @@ }; Verbose.prototype.indentSpec = function(current, last, color) { - var indent, name, output, _i, _len; + var lines, name, _i, _len; last = last.slice(0); - output = []; - indent = ''; + lines = []; for (_i = 0, _len = current.length; _i < _len; _i++) { name = current[_i]; - if (last.shift() !== name) output.push(indent + name.foreground(color)); + if (last.shift() !== name) { + lines.push(name); + } else { + lines.push(null); + } + } + return this.indentLines(lines, color); + }; + + Verbose.prototype.indentLines = function(lines, color) { + var indent, line, output, outputLine, _i, _len; + indent = ''; + output = []; + for (_i = 0, _len = lines.length; _i < _len; _i++) { + line = lines[_i]; + if (line != null) { + outputLine = indent; + outputLine += this.colorLine(line, color); + output.push(outputLine); + } indent += ' '; } return output; }; + Verbose.prototype.colorLine = function(line, color) { + return line.foreground(color); + }; + return Verbose; })();