Merge branch 'master' of https://github.com/d-reinhold/jasmine into d-reinhold-master
- Merges #1046 from @d-reinhold - Fixes #510
This commit is contained in:
@@ -71,6 +71,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
getWindowLocation: function() { return window.location; }
|
getWindowLocation: function() { return window.location; }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var filterSpecs = !!queryString.getParam("spec");
|
||||||
|
|
||||||
var catchingExceptions = queryString.getParam("catch");
|
var catchingExceptions = queryString.getParam("catch");
|
||||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||||
|
|
||||||
@@ -98,7 +100,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
getContainer: function() { return document.body; },
|
getContainer: function() { return document.body; },
|
||||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||||
timer: new jasmine.Timer()
|
timer: new jasmine.Timer(),
|
||||||
|
filterSpecs: filterSpecs
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,6 +49,8 @@
|
|||||||
getWindowLocation: function() { return window.location; }
|
getWindowLocation: function() { return window.location; }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var filterSpecs = !!queryString.getParam("spec");
|
||||||
|
|
||||||
var catchingExceptions = queryString.getParam("catch");
|
var catchingExceptions = queryString.getParam("catch");
|
||||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||||
|
|
||||||
@@ -76,7 +78,8 @@
|
|||||||
getContainer: function() { return document.body; },
|
getContainer: function() { return document.body; },
|
||||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||||
timer: new jasmine.Timer()
|
timer: new jasmine.Timer(),
|
||||||
|
filterSpecs: filterSpecs
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
onRandomClick = options.onRandomClick || function() {},
|
onRandomClick = options.onRandomClick || function() {},
|
||||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
|
filterSpecs = options.filterSpecs,
|
||||||
timer = options.timer || noopTimer,
|
timer = options.timer || noopTimer,
|
||||||
results = [],
|
results = [],
|
||||||
specsExecuted = 0,
|
specsExecuted = 0,
|
||||||
@@ -263,6 +264,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
var specListNode;
|
var specListNode;
|
||||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||||
var resultNode = resultsTree.children[i];
|
var resultNode = resultsTree.children[i];
|
||||||
|
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (resultNode.type == 'suite') {
|
if (resultNode.type == 'suite') {
|
||||||
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
||||||
createDom('li', {className: 'jasmine-suite-detail'},
|
createDom('li', {className: 'jasmine-suite-detail'},
|
||||||
@@ -390,6 +394,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||||
result.status === 'passed';
|
result.status === 'passed';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasActiveSpec(resultNode) {
|
||||||
|
if (resultNode.type == 'spec' && resultNode.result.status != 'disabled') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultNode.type == 'suite') {
|
||||||
|
for (var i = 0, j = resultNode.children.length; i < j; i++) {
|
||||||
|
if (hasActiveSpec(resultNode.children[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HtmlReporter;
|
return HtmlReporter;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -804,6 +804,64 @@ describe("New HtmlReporter", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("and there are disabled specs", function() {
|
||||||
|
var env, container, reporter, reporterConfig, specStatus;
|
||||||
|
beforeEach(function() {
|
||||||
|
env = new jasmineUnderTest.Env();
|
||||||
|
container = document.createElement("div");
|
||||||
|
reporterConfig = {
|
||||||
|
env: env,
|
||||||
|
getContainer: function() { return container; },
|
||||||
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
||||||
|
};
|
||||||
|
specStatus = {
|
||||||
|
id: 123,
|
||||||
|
description: "with a disabled spec",
|
||||||
|
fullName: "A Suite with a disabled spec",
|
||||||
|
status: "disabled",
|
||||||
|
passedExpectations: [],
|
||||||
|
failedExpectations: []
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when the specs are not filtered", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
reporterConfig.filterSpecs = false;
|
||||||
|
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
||||||
|
reporter.specStarted(specStatus);
|
||||||
|
reporter.specDone(specStatus);
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows the disabled spec in the spec list", function() {
|
||||||
|
var specList = container.querySelector(".jasmine-summary");
|
||||||
|
|
||||||
|
expect(specList.innerHTML).toContain('with a disabled spec');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when the specs are filtered", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
reporterConfig.filterSpecs = true;
|
||||||
|
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
||||||
|
reporter.specStarted(specStatus);
|
||||||
|
reporter.specDone(specStatus);
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("doesn't show the disabled spec in the spec list", function() {
|
||||||
|
var specList = container.querySelector(".jasmine-summary");
|
||||||
|
|
||||||
|
expect(specList.innerHTML).toEqual('');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("and there are pending specs", function() {
|
describe("and there are pending specs", function() {
|
||||||
var env, container, reporter;
|
var env, container, reporter;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
onRandomClick = options.onRandomClick || function() {},
|
onRandomClick = options.onRandomClick || function() {},
|
||||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
|
filterSpecs = options.filterSpecs,
|
||||||
timer = options.timer || noopTimer,
|
timer = options.timer || noopTimer,
|
||||||
results = [],
|
results = [],
|
||||||
specsExecuted = 0,
|
specsExecuted = 0,
|
||||||
@@ -234,6 +235,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
var specListNode;
|
var specListNode;
|
||||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||||
var resultNode = resultsTree.children[i];
|
var resultNode = resultsTree.children[i];
|
||||||
|
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (resultNode.type == 'suite') {
|
if (resultNode.type == 'suite') {
|
||||||
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
||||||
createDom('li', {className: 'jasmine-suite-detail'},
|
createDom('li', {className: 'jasmine-suite-detail'},
|
||||||
@@ -361,6 +365,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||||
result.status === 'passed';
|
result.status === 'passed';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasActiveSpec(resultNode) {
|
||||||
|
if (resultNode.type == 'spec' && resultNode.result.status != 'disabled') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultNode.type == 'suite') {
|
||||||
|
for (var i = 0, j = resultNode.children.length; i < j; i++) {
|
||||||
|
if (hasActiveSpec(resultNode.children[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HtmlReporter;
|
return HtmlReporter;
|
||||||
|
|||||||
Reference in New Issue
Block a user