Use const/let in specs, not var
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
describe('HtmlReporter', function() {
|
||||
var env;
|
||||
let env;
|
||||
|
||||
beforeEach(function() {
|
||||
env = new jasmineUnderTest.Env();
|
||||
@@ -10,7 +10,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('builds the initial DOM elements, including the title banner', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -35,18 +35,18 @@ describe('HtmlReporter', function() {
|
||||
expect(container.querySelector('ul.jasmine-symbol-summary')).toBeTruthy();
|
||||
|
||||
// title banner
|
||||
var banner = container.querySelector('.jasmine-banner');
|
||||
const banner = container.querySelector('.jasmine-banner');
|
||||
|
||||
var title = banner.querySelector('a.jasmine-title');
|
||||
const title = banner.querySelector('a.jasmine-title');
|
||||
expect(title.getAttribute('href')).toEqual('http://jasmine.github.io/');
|
||||
expect(title.getAttribute('target')).toEqual('_blank');
|
||||
|
||||
var version = banner.querySelector('.jasmine-version');
|
||||
const version = banner.querySelector('.jasmine-version');
|
||||
expect(version.textContent).toEqual(jasmineUnderTest.version);
|
||||
});
|
||||
|
||||
it('builds a single reporter even if initialized multiple times', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -71,7 +71,8 @@ describe('HtmlReporter', function() {
|
||||
|
||||
describe('when a spec is done', function() {
|
||||
describe('and no expectations ran', function() {
|
||||
var container, reporter;
|
||||
let container, reporter;
|
||||
|
||||
beforeEach(function() {
|
||||
container = document.createElement('div');
|
||||
reporter = new jasmineUnderTest.HtmlReporter({
|
||||
@@ -104,7 +105,7 @@ describe('HtmlReporter', function() {
|
||||
expect(console.warn).toHaveBeenCalledWith(
|
||||
"Spec 'Some Name' has no expectations."
|
||||
);
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
const specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute('class')).toEqual('jasmine-empty');
|
||||
});
|
||||
|
||||
@@ -119,13 +120,13 @@ describe('HtmlReporter', function() {
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
"Spec 'Some Name' has no expectations."
|
||||
);
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
const specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute('class')).toEqual('jasmine-failed');
|
||||
});
|
||||
});
|
||||
|
||||
it('reports the status symbol of a excluded spec', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -148,7 +149,7 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
const specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute('class')).toEqual('jasmine-excluded');
|
||||
expect(specEl.getAttribute('id')).toEqual('spec_789');
|
||||
expect(specEl.getAttribute('title')).toEqual(
|
||||
@@ -157,7 +158,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports the status symbol of a pending spec', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -180,13 +181,13 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
const specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute('class')).toEqual('jasmine-pending');
|
||||
expect(specEl.getAttribute('id')).toEqual('spec_789');
|
||||
});
|
||||
|
||||
it('reports the status symbol of a passing spec', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -209,14 +210,14 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var statuses = container.querySelector('.jasmine-symbol-summary');
|
||||
var specEl = statuses.querySelector('li');
|
||||
const statuses = container.querySelector('.jasmine-symbol-summary');
|
||||
const specEl = statuses.querySelector('li');
|
||||
expect(specEl.getAttribute('class')).toEqual('jasmine-passed');
|
||||
expect(specEl.getAttribute('id')).toEqual('spec_123');
|
||||
});
|
||||
|
||||
it('reports the status symbol of a failing spec', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -240,7 +241,7 @@ describe('HtmlReporter', function() {
|
||||
passedExpectations: []
|
||||
});
|
||||
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
const specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute('class')).toEqual('jasmine-failed');
|
||||
expect(specEl.getAttribute('id')).toEqual('spec_345');
|
||||
});
|
||||
@@ -248,7 +249,7 @@ describe('HtmlReporter', function() {
|
||||
|
||||
describe('when there are deprecation warnings', function() {
|
||||
it('displays the messages in their own alert bars', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -284,7 +285,9 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var alertBars = container.querySelectorAll('.jasmine-alert .jasmine-bar');
|
||||
const alertBars = container.querySelectorAll(
|
||||
'.jasmine-alert .jasmine-bar'
|
||||
);
|
||||
|
||||
expect(alertBars.length).toEqual(4);
|
||||
expect(alertBars[1].innerHTML).toMatch(
|
||||
@@ -301,7 +304,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('displays expandable stack traces', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -314,10 +317,7 @@ describe('HtmlReporter', function() {
|
||||
createTextNode: function() {
|
||||
return document.createTextNode.apply(document, arguments);
|
||||
}
|
||||
}),
|
||||
expander,
|
||||
expanderLink,
|
||||
expanderContents;
|
||||
});
|
||||
|
||||
reporter.initialize();
|
||||
|
||||
@@ -332,13 +332,15 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
expander = container.querySelector(
|
||||
const expander = container.querySelector(
|
||||
'.jasmine-alert .jasmine-bar .jasmine-expander'
|
||||
);
|
||||
expanderContents = expander.querySelector('.jasmine-expander-contents');
|
||||
const expanderContents = expander.querySelector(
|
||||
'.jasmine-expander-contents'
|
||||
);
|
||||
expect(expanderContents.textContent).toMatch(/a stack trace/);
|
||||
|
||||
expanderLink = expander.querySelector('a');
|
||||
const expanderLink = expander.querySelector('a');
|
||||
expect(expander).not.toHaveClass('jasmine-expanded');
|
||||
expect(expanderLink.textContent).toMatch(/Show stack trace/);
|
||||
|
||||
@@ -352,7 +354,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('omits the expander when there is no stack trace', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -365,8 +367,7 @@ describe('HtmlReporter', function() {
|
||||
createTextNode: function() {
|
||||
return document.createTextNode.apply(document, arguments);
|
||||
}
|
||||
}),
|
||||
warningBar;
|
||||
});
|
||||
|
||||
reporter.initialize();
|
||||
|
||||
@@ -381,12 +382,12 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
warningBar = container.querySelector('.jasmine-warning');
|
||||
const warningBar = container.querySelector('.jasmine-warning');
|
||||
expect(warningBar.querySelector('.jasmine-expander')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('nicely formats the verboseDeprecations note', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -399,8 +400,7 @@ describe('HtmlReporter', function() {
|
||||
createTextNode: function() {
|
||||
return document.createTextNode.apply(document, arguments);
|
||||
}
|
||||
}),
|
||||
alertBar;
|
||||
});
|
||||
|
||||
reporter.initialize();
|
||||
|
||||
@@ -415,7 +415,7 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
alertBar = container.querySelector('.jasmine-warning');
|
||||
const alertBar = container.querySelector('.jasmine-warning');
|
||||
|
||||
expect(alertBar.innerHTML).toMatch(
|
||||
/a deprecation<br>Note: This message will be shown only once/
|
||||
@@ -428,7 +428,7 @@ describe('HtmlReporter', function() {
|
||||
if (!window.console) {
|
||||
window.console = { error: function() {} };
|
||||
}
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -463,16 +463,16 @@ describe('HtmlReporter', function() {
|
||||
reporter.suiteDone({ id: 1 });
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var summary = container.querySelector('.jasmine-summary');
|
||||
var suite = summary.childNodes[0];
|
||||
var specs = suite.childNodes[1];
|
||||
var spec = specs.childNodes[0];
|
||||
var specLink = spec.childNodes[0];
|
||||
const summary = container.querySelector('.jasmine-summary');
|
||||
const suite = summary.childNodes[0];
|
||||
const specs = suite.childNodes[1];
|
||||
const spec = specs.childNodes[0];
|
||||
const specLink = spec.childNodes[0];
|
||||
expect(specLink.innerHTML).toMatch(/SPEC HAS NO EXPECTATIONS/);
|
||||
});
|
||||
|
||||
it('reports the run time', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -493,14 +493,14 @@ describe('HtmlReporter', function() {
|
||||
|
||||
reporter.jasmineDone({ totalTime: 100 });
|
||||
|
||||
var duration = container.querySelector(
|
||||
const duration = container.querySelector(
|
||||
'.jasmine-alert .jasmine-duration'
|
||||
);
|
||||
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
||||
});
|
||||
|
||||
it('reports the suite and spec names with status', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -526,7 +526,7 @@ describe('HtmlReporter', function() {
|
||||
fullName: 'A Suite'
|
||||
});
|
||||
|
||||
var specResult = {
|
||||
let specResult = {
|
||||
id: 123,
|
||||
description: 'with a spec',
|
||||
fullName: 'A Suite with a spec',
|
||||
@@ -543,7 +543,7 @@ describe('HtmlReporter', function() {
|
||||
fullName: 'A Suite inner suite'
|
||||
});
|
||||
|
||||
var specResult = {
|
||||
specResult = {
|
||||
id: 124,
|
||||
description: 'with another spec',
|
||||
fullName: 'A Suite inner suite with another spec',
|
||||
@@ -580,16 +580,16 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
reporter.jasmineDone({});
|
||||
var summary = container.querySelector('.jasmine-summary');
|
||||
const summary = container.querySelector('.jasmine-summary');
|
||||
|
||||
expect(summary.childNodes.length).toEqual(1);
|
||||
|
||||
var outerSuite = summary.childNodes[0];
|
||||
const outerSuite = summary.childNodes[0];
|
||||
expect(outerSuite.childNodes.length).toEqual(4);
|
||||
|
||||
var classes = [];
|
||||
for (var i = 0; i < outerSuite.childNodes.length; i++) {
|
||||
var node = outerSuite.childNodes[i];
|
||||
const classes = [];
|
||||
for (let i = 0; i < outerSuite.childNodes.length; i++) {
|
||||
const node = outerSuite.childNodes[i];
|
||||
classes.push(node.getAttribute('class'));
|
||||
}
|
||||
expect(classes).toEqual([
|
||||
@@ -599,17 +599,17 @@ describe('HtmlReporter', function() {
|
||||
'jasmine-specs'
|
||||
]);
|
||||
|
||||
var suiteDetail = outerSuite.childNodes[0];
|
||||
var suiteLink = suiteDetail.childNodes[0];
|
||||
const suiteDetail = outerSuite.childNodes[0];
|
||||
const suiteLink = suiteDetail.childNodes[0];
|
||||
expect(suiteLink.innerHTML).toEqual('A Suite');
|
||||
expect(suiteLink.getAttribute('href')).toEqual('/?foo=bar&spec=A Suite');
|
||||
|
||||
var specs = outerSuite.childNodes[1];
|
||||
var spec = specs.childNodes[0];
|
||||
const specs = outerSuite.childNodes[1];
|
||||
const spec = specs.childNodes[0];
|
||||
expect(spec.getAttribute('class')).toEqual('jasmine-passed');
|
||||
expect(spec.getAttribute('id')).toEqual('spec-123');
|
||||
|
||||
var specLink = spec.childNodes[0];
|
||||
const specLink = spec.childNodes[0];
|
||||
expect(specLink.innerHTML).toEqual('with a spec');
|
||||
expect(specLink.getAttribute('href')).toEqual(
|
||||
'/?foo=bar&spec=A Suite with a spec'
|
||||
@@ -617,7 +617,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('has an options menu', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -635,7 +635,7 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var trigger = container.querySelector(
|
||||
const trigger = container.querySelector(
|
||||
'.jasmine-run-options .jasmine-trigger'
|
||||
),
|
||||
payload = container.querySelector(
|
||||
@@ -655,7 +655,7 @@ describe('HtmlReporter', function() {
|
||||
|
||||
describe('when there are global errors', function() {
|
||||
it('displays the exceptions in their own alert bars', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -683,7 +683,7 @@ describe('HtmlReporter', function() {
|
||||
]
|
||||
});
|
||||
|
||||
var alertBars = container.querySelectorAll(
|
||||
const alertBars = container.querySelectorAll(
|
||||
'.jasmine-alert .jasmine-bar'
|
||||
);
|
||||
|
||||
@@ -745,7 +745,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('displays file and line information if available', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -774,7 +774,7 @@ describe('HtmlReporter', function() {
|
||||
]
|
||||
});
|
||||
|
||||
var alertBars = container.querySelectorAll(
|
||||
const alertBars = container.querySelectorAll(
|
||||
'.jasmine-alert .jasmine-bar'
|
||||
);
|
||||
|
||||
@@ -787,7 +787,7 @@ describe('HtmlReporter', function() {
|
||||
|
||||
describe('UI for stop on spec failure', function() {
|
||||
it('should be unchecked for full execution', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -805,12 +805,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
const stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
expect(stopOnFailureUI.checked).toBe(false);
|
||||
});
|
||||
|
||||
it('should be checked if stopping short', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -830,12 +830,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
const stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
expect(stopOnFailureUI.checked).toBe(true);
|
||||
});
|
||||
|
||||
it('should navigate and turn the setting on', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
navigationHandler = jasmine.createSpy('navigate'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
@@ -855,7 +855,7 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
const stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
stopOnFailureUI.click();
|
||||
|
||||
expect(navigationHandler).toHaveBeenCalledWith(
|
||||
@@ -865,7 +865,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('should navigate and turn the setting off', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
navigationHandler = jasmine.createSpy('navigate'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
@@ -887,7 +887,7 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
const stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
|
||||
stopOnFailureUI.click();
|
||||
|
||||
expect(navigationHandler).toHaveBeenCalledWith(
|
||||
@@ -899,7 +899,7 @@ describe('HtmlReporter', function() {
|
||||
|
||||
describe('UI for throwing errors on expectation failures', function() {
|
||||
it('should be unchecked if not throwing', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -917,12 +917,14 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var throwingExpectationsUI = container.querySelector('.jasmine-throw');
|
||||
const throwingExpectationsUI = container.querySelector(
|
||||
'.jasmine-throw'
|
||||
);
|
||||
expect(throwingExpectationsUI.checked).toBe(false);
|
||||
});
|
||||
|
||||
it('should be checked if throwing', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -942,12 +944,14 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var throwingExpectationsUI = container.querySelector('.jasmine-throw');
|
||||
const throwingExpectationsUI = container.querySelector(
|
||||
'.jasmine-throw'
|
||||
);
|
||||
expect(throwingExpectationsUI.checked).toBe(true);
|
||||
});
|
||||
|
||||
it('should navigate and change the setting to on', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
navigateHandler = jasmine.createSpy('navigate'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
@@ -967,7 +971,9 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var throwingExpectationsUI = container.querySelector('.jasmine-throw');
|
||||
const throwingExpectationsUI = container.querySelector(
|
||||
'.jasmine-throw'
|
||||
);
|
||||
throwingExpectationsUI.click();
|
||||
|
||||
expect(navigateHandler).toHaveBeenCalledWith(
|
||||
@@ -977,7 +983,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('should navigate and change the setting to off', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
navigateHandler = jasmine.createSpy('navigate'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
@@ -999,7 +1005,9 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var throwingExpectationsUI = container.querySelector('.jasmine-throw');
|
||||
const throwingExpectationsUI = container.querySelector(
|
||||
'.jasmine-throw'
|
||||
);
|
||||
throwingExpectationsUI.click();
|
||||
|
||||
expect(navigateHandler).toHaveBeenCalledWith(
|
||||
@@ -1010,7 +1018,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
describe('UI for hiding disabled specs', function() {
|
||||
it('should be unchecked if not hiding disabled specs', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1029,12 +1037,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var disabledUI = container.querySelector('.jasmine-disabled');
|
||||
const disabledUI = container.querySelector('.jasmine-disabled');
|
||||
expect(disabledUI.checked).toBe(false);
|
||||
});
|
||||
|
||||
it('should be checked if hiding disabled', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1053,12 +1061,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var disabledUI = container.querySelector('.jasmine-disabled');
|
||||
const disabledUI = container.querySelector('.jasmine-disabled');
|
||||
expect(disabledUI.checked).toBe(true);
|
||||
});
|
||||
|
||||
it('should not display specs that have been disabled', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1083,7 +1091,7 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
const specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute('class')).toEqual(
|
||||
'jasmine-excluded-no-display'
|
||||
);
|
||||
@@ -1091,7 +1099,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
describe('UI for running tests in random order', function() {
|
||||
it('should be unchecked if not randomizing', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1110,12 +1118,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var randomUI = container.querySelector('.jasmine-random');
|
||||
const randomUI = container.querySelector('.jasmine-random');
|
||||
expect(randomUI.checked).toBe(false);
|
||||
});
|
||||
|
||||
it('should be checked if randomizing', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1134,12 +1142,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var randomUI = container.querySelector('.jasmine-random');
|
||||
const randomUI = container.querySelector('.jasmine-random');
|
||||
expect(randomUI.checked).toBe(true);
|
||||
});
|
||||
|
||||
it('should navigate and change the setting to on', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
navigateHandler = jasmine.createSpy('navigate'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
@@ -1160,14 +1168,14 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var randomUI = container.querySelector('.jasmine-random');
|
||||
const randomUI = container.querySelector('.jasmine-random');
|
||||
randomUI.click();
|
||||
|
||||
expect(navigateHandler).toHaveBeenCalledWith('random', true);
|
||||
});
|
||||
|
||||
it('should navigate and change the setting to off', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
navigateHandler = jasmine.createSpy('navigate'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
@@ -1188,14 +1196,14 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var randomUI = container.querySelector('.jasmine-random');
|
||||
const randomUI = container.querySelector('.jasmine-random');
|
||||
randomUI.click();
|
||||
|
||||
expect(navigateHandler).toHaveBeenCalledWith('random', false);
|
||||
});
|
||||
|
||||
it('should show the seed bar if randomizing', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1218,14 +1226,14 @@ describe('HtmlReporter', function() {
|
||||
}
|
||||
});
|
||||
|
||||
var seedBar = container.querySelector('.jasmine-seed-bar');
|
||||
const seedBar = container.querySelector('.jasmine-seed-bar');
|
||||
expect(seedBar.textContent).toBe(', randomized with seed 424242');
|
||||
var seedLink = container.querySelector('.jasmine-seed-bar a');
|
||||
const seedLink = container.querySelector('.jasmine-seed-bar a');
|
||||
expect(seedLink.getAttribute('href')).toBe('/?seed=424242');
|
||||
});
|
||||
|
||||
it('should not show the current seed bar if not randomizing', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1243,12 +1251,12 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var seedBar = container.querySelector('.jasmine-seed-bar');
|
||||
const seedBar = container.querySelector('.jasmine-seed-bar');
|
||||
expect(seedBar).toBeNull();
|
||||
});
|
||||
|
||||
it('should include non-spec query params in the jasmine-skipped link when present', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
reporter = new jasmineUnderTest.HtmlReporter({
|
||||
env: env,
|
||||
getContainer: function() {
|
||||
@@ -1269,16 +1277,17 @@ describe('HtmlReporter', function() {
|
||||
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
||||
reporter.jasmineDone({ order: { random: true } });
|
||||
|
||||
var skippedLink = container.querySelector('.jasmine-skipped a');
|
||||
const skippedLink = container.querySelector('.jasmine-skipped a');
|
||||
expect(skippedLink.getAttribute('href')).toEqual('/?foo=bar&spec=');
|
||||
});
|
||||
});
|
||||
|
||||
describe('and all specs pass', function() {
|
||||
var container;
|
||||
let container;
|
||||
|
||||
beforeEach(function() {
|
||||
container = document.createElement('div');
|
||||
var getContainer = function() {
|
||||
const getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
reporter = new jasmineUnderTest.HtmlReporter({
|
||||
@@ -1314,7 +1323,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports the specs counts', function() {
|
||||
var alertBars = container.querySelectorAll(
|
||||
const alertBars = container.querySelectorAll(
|
||||
'.jasmine-alert .jasmine-bar'
|
||||
);
|
||||
|
||||
@@ -1323,20 +1332,21 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports no failure details', function() {
|
||||
var specFailure = container.querySelector('.jasmine-failures');
|
||||
const specFailure = container.querySelector('.jasmine-failures');
|
||||
|
||||
expect(specFailure.childNodes.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('reports no pending specs', function() {
|
||||
var alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
const alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
|
||||
expect(alertBar.innerHTML).not.toMatch(/pending spec[s]/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('and there are excluded specs', function() {
|
||||
var container, reporter, reporterConfig, specStatus;
|
||||
let container, reporter, reporterConfig, specStatus;
|
||||
|
||||
beforeEach(function() {
|
||||
container = document.createElement('div');
|
||||
reporterConfig = {
|
||||
@@ -1373,7 +1383,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('shows the excluded spec in the spec list', function() {
|
||||
var specList = container.querySelector('.jasmine-summary');
|
||||
const specList = container.querySelector('.jasmine-summary');
|
||||
|
||||
expect(specList.innerHTML).toContain('with a excluded spec');
|
||||
});
|
||||
@@ -1391,7 +1401,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it("doesn't show the excluded spec in the spec list", function() {
|
||||
var specList = container.querySelector('.jasmine-summary');
|
||||
const specList = container.querySelector('.jasmine-summary');
|
||||
|
||||
expect(specList.innerHTML).toEqual('');
|
||||
});
|
||||
@@ -1399,10 +1409,11 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
describe('and there are pending specs', function() {
|
||||
var container, reporter;
|
||||
let container, reporter;
|
||||
|
||||
beforeEach(function() {
|
||||
container = document.createElement('div');
|
||||
var getContainer = function() {
|
||||
const getContainer = function() {
|
||||
return container;
|
||||
};
|
||||
reporter = new jasmineUnderTest.HtmlReporter({
|
||||
@@ -1418,7 +1429,7 @@ describe('HtmlReporter', function() {
|
||||
reporter.initialize();
|
||||
|
||||
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
||||
var specStatus = {
|
||||
const specStatus = {
|
||||
id: 123,
|
||||
description: 'with a spec',
|
||||
fullName: 'A Suite with a spec',
|
||||
@@ -1433,7 +1444,7 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports the pending specs count', function() {
|
||||
var alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
const alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
|
||||
expect(alertBar.innerHTML).toMatch(
|
||||
/1 spec, 0 failures, 1 pending spec/
|
||||
@@ -1441,13 +1452,13 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports no failure details', function() {
|
||||
var specFailure = container.querySelector('.jasmine-failures');
|
||||
const specFailure = container.querySelector('.jasmine-failures');
|
||||
|
||||
expect(specFailure.childNodes.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('displays the custom pending reason', function() {
|
||||
var pendingDetails = container.querySelector(
|
||||
const pendingDetails = container.querySelector(
|
||||
'.jasmine-summary .jasmine-pending'
|
||||
);
|
||||
|
||||
@@ -1456,11 +1467,11 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
describe('and some tests fail', function() {
|
||||
var container, reporter;
|
||||
let container, reporter;
|
||||
|
||||
beforeEach(function() {
|
||||
container = document.createElement('div');
|
||||
var getContainer = function() {
|
||||
const getContainer = function() {
|
||||
return container;
|
||||
};
|
||||
reporter = new jasmineUnderTest.HtmlReporter({
|
||||
@@ -1488,7 +1499,7 @@ describe('HtmlReporter', function() {
|
||||
description: 'inner suite'
|
||||
});
|
||||
|
||||
var passingSpecResult = {
|
||||
const passingSpecResult = {
|
||||
id: 123,
|
||||
status: 'passed',
|
||||
passedExpectations: [{ passed: true }],
|
||||
@@ -1497,7 +1508,7 @@ describe('HtmlReporter', function() {
|
||||
reporter.specStarted(passingSpecResult);
|
||||
reporter.specDone(passingSpecResult);
|
||||
|
||||
var failingSpecResult = {
|
||||
const failingSpecResult = {
|
||||
id: 124,
|
||||
status: 'failed',
|
||||
description: 'a failing spec',
|
||||
@@ -1510,7 +1521,7 @@ describe('HtmlReporter', function() {
|
||||
}
|
||||
]
|
||||
};
|
||||
var failingSpecResultWithDebugLogs = {
|
||||
const failingSpecResultWithDebugLogs = {
|
||||
id: 567,
|
||||
status: 'failed',
|
||||
description: 'a failing spec',
|
||||
@@ -1528,11 +1539,11 @@ describe('HtmlReporter', function() {
|
||||
]
|
||||
};
|
||||
|
||||
var passingSuiteResult = {
|
||||
const passingSuiteResult = {
|
||||
id: 1,
|
||||
description: 'A suite'
|
||||
};
|
||||
var failingSuiteResult = {
|
||||
const failingSuiteResult = {
|
||||
id: 2,
|
||||
description: 'a suite',
|
||||
fullName: 'a suite',
|
||||
@@ -1550,48 +1561,48 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports the specs counts', function() {
|
||||
var alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
const alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
expect(alertBar.innerHTML).toMatch(/3 specs, 3 failures/);
|
||||
});
|
||||
|
||||
it('reports failure messages and stack traces', function() {
|
||||
var specFailures = container.querySelector('.jasmine-failures');
|
||||
const specFailures = container.querySelector('.jasmine-failures');
|
||||
|
||||
expect(specFailures.childNodes.length).toEqual(3);
|
||||
|
||||
var specFailure = specFailures.childNodes[0];
|
||||
const specFailure = specFailures.childNodes[0];
|
||||
expect(specFailure.getAttribute('class')).toMatch(/jasmine-failed/);
|
||||
expect(specFailure.getAttribute('class')).toMatch(
|
||||
/jasmine-spec-detail/
|
||||
);
|
||||
|
||||
var specDiv = specFailure.childNodes[0];
|
||||
const specDiv = specFailure.childNodes[0];
|
||||
expect(specDiv.getAttribute('class')).toEqual('jasmine-description');
|
||||
|
||||
var message = specFailure.childNodes[1].childNodes[0];
|
||||
const message = specFailure.childNodes[1].childNodes[0];
|
||||
expect(message.getAttribute('class')).toEqual('jasmine-result-message');
|
||||
expect(message.innerHTML).toEqual('a failure message');
|
||||
|
||||
var stackTrace = specFailure.childNodes[1].childNodes[1];
|
||||
const stackTrace = specFailure.childNodes[1].childNodes[1];
|
||||
expect(stackTrace.getAttribute('class')).toEqual('jasmine-stack-trace');
|
||||
expect(stackTrace.innerHTML).toEqual('a stack trace');
|
||||
|
||||
var suiteFailure = specFailures.childNodes[0];
|
||||
const suiteFailure = specFailures.childNodes[0];
|
||||
expect(suiteFailure.getAttribute('class')).toMatch(/jasmine-failed/);
|
||||
expect(suiteFailure.getAttribute('class')).toMatch(
|
||||
/jasmine-spec-detail/
|
||||
);
|
||||
|
||||
var suiteDiv = suiteFailure.childNodes[0];
|
||||
const suiteDiv = suiteFailure.childNodes[0];
|
||||
expect(suiteDiv.getAttribute('class')).toEqual('jasmine-description');
|
||||
|
||||
var suiteMessage = suiteFailure.childNodes[1].childNodes[0];
|
||||
const suiteMessage = suiteFailure.childNodes[1].childNodes[0];
|
||||
expect(suiteMessage.getAttribute('class')).toEqual(
|
||||
'jasmine-result-message'
|
||||
);
|
||||
expect(suiteMessage.innerHTML).toEqual('a failure message');
|
||||
|
||||
var suiteStackTrace = suiteFailure.childNodes[1].childNodes[1];
|
||||
const suiteStackTrace = suiteFailure.childNodes[1].childNodes[1];
|
||||
expect(suiteStackTrace.getAttribute('class')).toEqual(
|
||||
'jasmine-stack-trace'
|
||||
);
|
||||
@@ -1599,22 +1610,21 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('reports traces when present', function() {
|
||||
var specFailure = container.querySelectorAll(
|
||||
const specFailure = container.querySelectorAll(
|
||||
'.jasmine-spec-detail.jasmine-failed'
|
||||
)[2],
|
||||
debugLogs = specFailure.querySelector('.jasmine-debug-log table'),
|
||||
rows;
|
||||
debugLogs = specFailure.querySelector('.jasmine-debug-log table');
|
||||
|
||||
expect(debugLogs).toBeTruthy();
|
||||
rows = debugLogs.querySelectorAll('tbody tr');
|
||||
const rows = debugLogs.querySelectorAll('tbody tr');
|
||||
expect(rows.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('provides links to focus on a failure and each containing suite', function() {
|
||||
var description = container.querySelector(
|
||||
const description = container.querySelector(
|
||||
'.jasmine-failures .jasmine-description'
|
||||
);
|
||||
var links = description.querySelectorAll('a');
|
||||
const links = description.querySelectorAll('a');
|
||||
|
||||
expect(description.textContent).toEqual(
|
||||
'A suite > inner suite > a failing spec'
|
||||
@@ -1637,17 +1647,17 @@ describe('HtmlReporter', function() {
|
||||
});
|
||||
|
||||
it('allows switching between failure details and the spec summary', function() {
|
||||
var menuBar = container.querySelectorAll('.jasmine-bar')[1];
|
||||
const menuBar = container.querySelectorAll('.jasmine-bar')[1];
|
||||
|
||||
expect(menuBar.getAttribute('class')).not.toMatch(/hidden/);
|
||||
|
||||
var link = menuBar.querySelector('a');
|
||||
const link = menuBar.querySelector('a');
|
||||
expect(link.innerHTML).toEqual('Failures');
|
||||
expect(link.getAttribute('href')).toEqual('#');
|
||||
});
|
||||
|
||||
it("sets the reporter to 'Failures List' mode", function() {
|
||||
var reporterNode = container.querySelector('.jasmine_html-reporter');
|
||||
const reporterNode = container.querySelector('.jasmine_html-reporter');
|
||||
expect(reporterNode.getAttribute('class')).toMatch(
|
||||
'jasmine-failure-list'
|
||||
);
|
||||
@@ -1713,7 +1723,7 @@ describe('HtmlReporter', function() {
|
||||
describe('The overall result bar', function() {
|
||||
describe("When the jasmineDone event's overallStatus is 'passed'", function() {
|
||||
it('has class jasmine-passed', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1736,14 +1746,14 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var alertBar = container.querySelector('.jasmine-overall-result');
|
||||
const alertBar = container.querySelector('.jasmine-overall-result');
|
||||
expect(alertBar).toHaveClass('jasmine-passed');
|
||||
});
|
||||
});
|
||||
|
||||
describe("When the jasmineDone event's overallStatus is 'failed'", function() {
|
||||
it('has class jasmine-failed', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1766,14 +1776,14 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var alertBar = container.querySelector('.jasmine-overall-result');
|
||||
const alertBar = container.querySelector('.jasmine-overall-result');
|
||||
expect(alertBar).toHaveClass('jasmine-failed');
|
||||
});
|
||||
});
|
||||
|
||||
describe("When the jasmineDone event's overallStatus is 'incomplete'", function() {
|
||||
it('has class jasmine-incomplete', function() {
|
||||
var container = document.createElement('div'),
|
||||
const container = document.createElement('div'),
|
||||
getContainer = function() {
|
||||
return container;
|
||||
},
|
||||
@@ -1797,7 +1807,7 @@ describe('HtmlReporter', function() {
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
var alertBar = container.querySelector('.jasmine-overall-result');
|
||||
const alertBar = container.querySelector('.jasmine-overall-result');
|
||||
expect(alertBar).toHaveClass('jasmine-incomplete');
|
||||
expect(alertBar.textContent).toContain('Incomplete: because nope');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user