diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js
index 221a15d5..a5c29417 100644
--- a/lib/jasmine-core/jasmine-html.js
+++ b/lib/jasmine-core/jasmine-html.js
@@ -88,7 +88,8 @@ jasmineRequire.HtmlReporter = function(j$) {
results = [],
htmlReporterMain,
symbols,
- failedSuites = [];
+ failedSuites = [],
+ deprecationWarnings = [];
this.initialize = function() {
clearPrior();
@@ -126,6 +127,7 @@ jasmineRequire.HtmlReporter = function(j$) {
}
stateBuilder.suiteDone(result);
+ addDeprecationWarnings(result);
};
this.specStarted = function(result) {
@@ -169,6 +171,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failures.push(failure);
}
+
+ addDeprecationWarnings(result);
};
this.jasmineDone = function(doneResult) {
@@ -278,6 +282,14 @@ jasmineRequire.HtmlReporter = function(j$) {
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
}
+ addDeprecationWarnings(doneResult);
+
+ var warningBarClassName = 'jasmine-bar jasmine-warning';
+ for(i = 0; i < deprecationWarnings.length; i++) {
+ var warning = deprecationWarnings[i];
+ alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning.message));
+ }
+
var results = find('.jasmine-results');
results.appendChild(summary);
@@ -352,6 +364,12 @@ jasmineRequire.HtmlReporter = function(j$) {
return this;
+ function addDeprecationWarnings(result) {
+ if (result && result.deprecationWarnings && result.deprecationWarnings.length > 0) {
+ deprecationWarnings = deprecationWarnings.concat(result.deprecationWarnings);
+ }
+ }
+
function find(selector) {
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
}
diff --git a/lib/jasmine-core/jasmine.css b/lib/jasmine-core/jasmine.css
index 63199827..3144f266 100644
--- a/lib/jasmine-core/jasmine.css
+++ b/lib/jasmine-core/jasmine.css
@@ -33,6 +33,7 @@ body { overflow-y: scroll; }
.jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; }
.jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; }
.jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; }
+.jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; }
.jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; }
.jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; }
.jasmine_html-reporter .jasmine-bar a { color: white; }
diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js
index 25d6d69c..9e3ab587 100644
--- a/spec/core/integration/EnvSpec.js
+++ b/spec/core/integration/EnvSpec.js
@@ -2011,29 +2011,20 @@ describe("Env integration", function() {
reporter.jasmineDone.and.callFake(function(result) {
expect(result.deprecationWarnings).toEqual([
- jasmine.objectContaining({
- message: 'top level deprecation',
- stack: jasmine.any(String)
- })
+ jasmine.objectContaining({ message: 'top level deprecation' })
]);
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({
fullName: 'suite',
deprecationWarnings: [
- jasmine.objectContaining({
- message: 'suite level deprecation',
- stack: jasmine.any(String)
- })
+ jasmine.objectContaining({ message: 'suite level deprecation' })
]
}));
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
fullName: 'suite spec',
deprecationWarnings: [
- jasmine.objectContaining({
- message: 'spec level deprecation',
- stack: jasmine.any(String)
- })
+ jasmine.objectContaining({ message: 'spec level deprecation' })
]
}));
diff --git a/spec/html/HtmlReporterSpec.js b/spec/html/HtmlReporterSpec.js
index 59138c8a..c585b79e 100644
--- a/spec/html/HtmlReporterSpec.js
+++ b/spec/html/HtmlReporterSpec.js
@@ -208,6 +208,47 @@ describe("New HtmlReporter", function() {
});
});
+ describe('when there are deprecation warnings', function() {
+ it('displays the messages in their own alert bars', function() {
+ var env = new jasmineUnderTest.Env(),
+ container = document.createElement('div'),
+ getContainer = function() { return container; },
+ reporter = new jasmineUnderTest.HtmlReporter({
+ env: env,
+ getContainer: getContainer,
+ createElement: function() { return document.createElement.apply(document, arguments); },
+ createTextNode: function() { return document.createTextNode.apply(document, arguments); }
+ });
+
+ reporter.initialize();
+
+ reporter.jasmineStarted({});
+ reporter.specDone({
+ status: 'passed',
+ deprecationWarnings: [{ message: 'spec deprecation' }],
+ failedExpectations: [],
+ passedExpectations: []
+ });
+ reporter.suiteDone({
+ status: 'passed',
+ deprecationWarnings: [{ message: 'suite deprecation' }],
+ failedExpectations: []
+ });
+ reporter.jasmineDone({
+ deprecationWarnings: [{ message: 'global deprecation' }],
+ failedExpectations: []
+ });
+
+ var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
+
+ expect(alertBars.length).toEqual(4);
+ expect(alertBars[1].innerHTML).toMatch(/spec deprecation/);
+ expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-warning');
+ expect(alertBars[2].innerHTML).toMatch(/suite deprecation/);
+ expect(alertBars[3].innerHTML).toMatch(/global deprecation/);
+ });
+ });
+
describe("when Jasmine is done", function() {
it("adds a warning to the link title of specs that have no expectations", function() {
if (!window.console) {
diff --git a/src/html/HtmlReporter.js b/src/html/HtmlReporter.js
index 6ce6a41b..724050e6 100644
--- a/src/html/HtmlReporter.js
+++ b/src/html/HtmlReporter.js
@@ -59,7 +59,8 @@ jasmineRequire.HtmlReporter = function(j$) {
results = [],
htmlReporterMain,
symbols,
- failedSuites = [];
+ failedSuites = [],
+ deprecationWarnings = [];
this.initialize = function() {
clearPrior();
@@ -97,6 +98,7 @@ jasmineRequire.HtmlReporter = function(j$) {
}
stateBuilder.suiteDone(result);
+ addDeprecationWarnings(result);
};
this.specStarted = function(result) {
@@ -140,6 +142,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failures.push(failure);
}
+
+ addDeprecationWarnings(result);
};
this.jasmineDone = function(doneResult) {
@@ -249,6 +253,14 @@ jasmineRequire.HtmlReporter = function(j$) {
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
}
+ addDeprecationWarnings(doneResult);
+
+ var warningBarClassName = 'jasmine-bar jasmine-warning';
+ for(i = 0; i < deprecationWarnings.length; i++) {
+ var warning = deprecationWarnings[i];
+ alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning.message));
+ }
+
var results = find('.jasmine-results');
results.appendChild(summary);
@@ -323,6 +335,12 @@ jasmineRequire.HtmlReporter = function(j$) {
return this;
+ function addDeprecationWarnings(result) {
+ if (result && result.deprecationWarnings && result.deprecationWarnings.length > 0) {
+ deprecationWarnings = deprecationWarnings.concat(result.deprecationWarnings);
+ }
+ }
+
function find(selector) {
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
}
diff --git a/src/html/_HTMLReporter.scss b/src/html/_HTMLReporter.scss
index 093692b9..de8d0145 100644
--- a/src/html/_HTMLReporter.scss
+++ b/src/html/_HTMLReporter.scss
@@ -216,6 +216,10 @@ body {
background-color: $failing-color;
}
+ &.jasmine-warning {
+ background-color: $pending-color;
+ }
+
&.jasmine-menu {
background-color: #fff;
color: $faint-text-color;