Move specFilter function to TrivialReporter.

This commit is contained in:
Aaron Peckham & Christian Williams
2009-08-10 16:00:42 -07:00
parent e476f2375a
commit b1a007dfb5
4 changed files with 52 additions and 39 deletions

View File

@@ -59,6 +59,22 @@ jasmine.TrivialReporter.prototype.log = function() {
console.log.apply(console, arguments);
};
jasmine.TrivialReporter.prototype.getLocation = function() {
return document.location;
};
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
var paramMap = {};
var params = this.getLocation().search.substring(1).split('&');
for (var i = 0; i < params.length; i++) {
var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
}
if (!paramMap["spec"]) return true;
return spec.getFullName().indexOf(paramMap["spec"]) > -1;
};
//protect against console.log incidents
if (!("console" in window) || !("firebug" in console)) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];