Skip to content

Commit

Permalink
put back file I deleted for no discernable reason
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeast committed Jun 3, 2013
1 parent 9603ce2 commit 2786dda
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions spec/html/HtmlReporterHelpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
jasmine.HtmlReporterHelpers = {};

jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
var el = document.createElement(type);

for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];

if (typeof child === 'string') {
el.appendChild(document.createTextNode(child));
} else {
if (child) {
el.appendChild(child);
}
}
}

for (var attr in attrs) {
if (attr == "className") {
el[attr] = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
}

return el;
};

jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
var results = child.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) {
status = 'skipped';
}

return status;
};

jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
var parentDiv = this.dom.summary;
var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
var parent = child[parentSuite];

if (parent) {
if (typeof this.views.suites[parent.id] == 'undefined') {
this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
}
parentDiv = this.views.suites[parent.id].element;
}

parentDiv.appendChild(childElement);
};


jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
for(var fn in jasmine.HtmlReporterHelpers) {
ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
}
};

0 comments on commit 2786dda

Please sign in to comment.