Moved dependencies out of HtmlReporter and into boot.js - QueryString for spec filtering and UI around raising exceptions checkbox; New object for handling spec filtering for browsers;
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
var htmlReporter = new jasmine.HtmlReporter({
|
||||
env: env,
|
||||
queryString: queryString,
|
||||
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
|
||||
getContainer: function() { return document.body; },
|
||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
||||
@@ -70,8 +71,12 @@
|
||||
env.addReporter(jasmineInterface.jsApiReporter);
|
||||
env.addReporter(htmlReporter);
|
||||
|
||||
var specFilter = new jasmine.HtmlSpecFilter({
|
||||
filterString: function() { return queryString.getParam("spec"); }
|
||||
});
|
||||
|
||||
env.specFilter = function(spec) {
|
||||
return htmlReporter.specFilter(spec);
|
||||
return specFilter.matches(spec);
|
||||
};
|
||||
|
||||
var currentWindowOnload = window.onload;
|
||||
|
||||
@@ -5,7 +5,6 @@ jasmine.HtmlReporter = function(options) {
|
||||
createElement = options.createElement,
|
||||
createTextNode = options.createTextNode,
|
||||
results = [],
|
||||
queryString = options.queryString,
|
||||
startTime,
|
||||
specsExecuted = 0,
|
||||
failureCount = 0,
|
||||
@@ -29,18 +28,6 @@ jasmine.HtmlReporter = function(options) {
|
||||
symbols = find(".symbol-summary")[0];
|
||||
};
|
||||
|
||||
var specFilterPattern;
|
||||
|
||||
this.specFilter = function(spec) {
|
||||
if (!isFiltered()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var specName = spec.getFullName();
|
||||
|
||||
return !!(specName.match(specFilterPattern));
|
||||
};
|
||||
|
||||
var totalSpecsDefined;
|
||||
this.jasmineStarted = function(options) {
|
||||
totalSpecsDefined = options.totalSpecsDefined || 0;
|
||||
@@ -120,9 +107,7 @@ jasmine.HtmlReporter = function(options) {
|
||||
var checkbox = find("input")[0];
|
||||
|
||||
checkbox.checked = !env.catchingExceptions();
|
||||
checkbox.onclick = function() {
|
||||
queryString.setParam("catch", !checkbox.checked);
|
||||
};
|
||||
checkbox.onclick = options.onRaiseExceptionsClick;
|
||||
|
||||
if (specsExecuted < totalSpecsDefined) {
|
||||
var skippedMessage = "Ran " + specsExecuted + " of " + totalSpecsDefined + " specs - run all";
|
||||
@@ -245,21 +230,15 @@ jasmine.HtmlReporter = function(options) {
|
||||
return "?spec=" + encodeURIComponent(result.fullName);
|
||||
}
|
||||
|
||||
function isFiltered() {
|
||||
buildSpecFilter();
|
||||
|
||||
return !!specFilterPattern;
|
||||
}
|
||||
|
||||
function buildSpecFilter() {
|
||||
var specFilterParam = queryString.getParam("spec") || "";
|
||||
|
||||
specFilterPattern = new RegExp(specFilterParam);
|
||||
}
|
||||
|
||||
function setMenuModeTo(mode) {
|
||||
htmlReporterMain.setAttribute("class", "html-reporter " + mode);
|
||||
}
|
||||
};jasmine.HtmlSpecFilter = function(options) {
|
||||
var filterPattern = new RegExp(options && options.filterString());
|
||||
|
||||
this.matches = function(specName) {
|
||||
return filterPattern.test(specName);
|
||||
};
|
||||
};jasmine.ResultsNode = function(result, type, parent) {
|
||||
this.result = result;
|
||||
this.type = type;
|
||||
|
||||
Reference in New Issue
Block a user