jasmine-headless-webkit/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js

49 lines
1.8 KiB
JavaScript
Raw Normal View History

2012-01-10 22:14:37 +00:00
(function() {
2012-01-11 14:58:47 +00:00
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2012-01-10 22:14:37 +00:00
2012-01-11 14:58:47 +00:00
jasmine.HeadlessReporter.Verbose = (function() {
2012-01-10 22:14:37 +00:00
2012-01-11 14:58:47 +00:00
__extends(Verbose, jasmine.HeadlessReporter.ConsoleBase);
2012-01-10 22:14:37 +00:00
function Verbose() {
this.indentSpec = __bind(this.indentSpec, this);
this.displaySpec = __bind(this.displaySpec, this);
this.displayFailure = __bind(this.displayFailure, this);
this.displaySuccess = __bind(this.displaySuccess, this);
Verbose.__super__.constructor.apply(this, arguments);
}
Verbose.prototype.displaySuccess = function(spec) {
return this.displaySpec(spec, 'green');
};
Verbose.prototype.displayFailure = function(spec) {
return this.displaySpec(spec, 'red');
};
Verbose.prototype.displaySpec = function(spec, color) {
var currentLastNames;
currentLastNames = (this.lastNames || []).slice(0);
this.lastNames = spec.getSpecSplitName();
return this.puts(this.indentSpec(this.lastNames, currentLastNames, color).join("\n"));
};
Verbose.prototype.indentSpec = function(current, last, color) {
var indent, name, output, _i, _len;
last = last.slice(0);
output = [];
indent = '';
for (_i = 0, _len = current.length; _i < _len; _i++) {
name = current[_i];
if (last.shift() !== name) output.push(indent + name.foreground(color));
indent += ' ';
}
return output;
};
return Verbose;
2012-01-11 14:58:47 +00:00
})();
2012-01-10 22:14:37 +00:00
}).call(this);