Backfill missing HTML reporter tests
This commit is contained in:
@@ -422,7 +422,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addSkipped(numExecuted, numDefined) {
|
addSkipped(numExecuted, numDefined) {
|
||||||
// TODO: backfill tests for this
|
|
||||||
this.add(
|
this.add(
|
||||||
'jasmine-bar jasmine-skipped',
|
'jasmine-bar jasmine-skipped',
|
||||||
createDom(
|
createDom(
|
||||||
@@ -469,7 +468,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|||||||
this.add(errorBarClassName, this.#globalFailureMessage(failure));
|
this.add(errorBarClassName, this.#globalFailureMessage(failure));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO check test coverage
|
|
||||||
addSeedBar(doneResult, stateBuilder, order) {
|
addSeedBar(doneResult, stateBuilder, order) {
|
||||||
let statusBarMessage = '';
|
let statusBarMessage = '';
|
||||||
let statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
let statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
||||||
@@ -521,7 +519,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|||||||
this.add(statusBarClassName, [statusBarMessage, seedBar]);
|
this.add(statusBarClassName, [statusBarMessage, seedBar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO check test coverage
|
|
||||||
#globalFailureMessage(failure) {
|
#globalFailureMessage(failure) {
|
||||||
if (failure.globalErrorType === 'load') {
|
if (failure.globalErrorType === 'load') {
|
||||||
const prefix = 'Error during loading: ' + failure.message;
|
const prefix = 'Error during loading: ' + failure.message;
|
||||||
@@ -746,7 +743,6 @@ jasmineRequire.Banner = function(j$) {
|
|||||||
'#jasmine-hide-disabled'
|
'#jasmine-hide-disabled'
|
||||||
);
|
);
|
||||||
hideDisabled.checked = config.hideDisabled;
|
hideDisabled.checked = config.hideDisabled;
|
||||||
// TODO: backfill tests for this!
|
|
||||||
hideDisabled.onclick = () => {
|
hideDisabled.onclick = () => {
|
||||||
this.#navigateWithNewParam('hideDisabled', !config.hideDisabled);
|
this.#navigateWithNewParam('hideDisabled', !config.hideDisabled);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -883,16 +883,19 @@ describe('HtmlReporter', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UI for hiding disabled specs', function() {
|
describe('UI for hiding disabled specs', function() {
|
||||||
it('should be unchecked if not hiding disabled specs', function() {
|
it('should be unchecked if not hiding disabled specs', function() {
|
||||||
const container = document.createElement('div'),
|
const container = document.createElement('div');
|
||||||
getContainer = function() {
|
const getContainer = function() {
|
||||||
return container;
|
return container;
|
||||||
},
|
};
|
||||||
reporter = new jasmineUnderTest.HtmlReporter({
|
const navigateHandler = jasmine.createSpy('navigate');
|
||||||
env: env,
|
const reporter = new jasmineUnderTest.HtmlReporter({
|
||||||
getContainer: getContainer
|
env: env,
|
||||||
});
|
getContainer: getContainer,
|
||||||
|
navigateWithNewParam: navigateHandler
|
||||||
|
});
|
||||||
|
|
||||||
env.configure({ hideDisabled: false });
|
env.configure({ hideDisabled: false });
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
@@ -900,17 +903,22 @@ describe('HtmlReporter', function() {
|
|||||||
|
|
||||||
const disabledUI = container.querySelector('.jasmine-disabled');
|
const disabledUI = container.querySelector('.jasmine-disabled');
|
||||||
expect(disabledUI.checked).toBe(false);
|
expect(disabledUI.checked).toBe(false);
|
||||||
|
|
||||||
|
disabledUI.click();
|
||||||
|
expect(navigateHandler).toHaveBeenCalledWith('hideDisabled', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be checked if hiding disabled', function() {
|
it('should be checked if hiding disabled', function() {
|
||||||
const container = document.createElement('div'),
|
const container = document.createElement('div');
|
||||||
getContainer = function() {
|
const getContainer = function() {
|
||||||
return container;
|
return container;
|
||||||
},
|
};
|
||||||
reporter = new jasmineUnderTest.HtmlReporter({
|
const navigateHandler = jasmine.createSpy('navigate');
|
||||||
env: env,
|
const reporter = new jasmineUnderTest.HtmlReporter({
|
||||||
getContainer: getContainer
|
env: env,
|
||||||
});
|
getContainer: getContainer,
|
||||||
|
navigateWithNewParam: navigateHandler
|
||||||
|
});
|
||||||
|
|
||||||
env.configure({ hideDisabled: true });
|
env.configure({ hideDisabled: true });
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
@@ -918,6 +926,9 @@ describe('HtmlReporter', function() {
|
|||||||
|
|
||||||
const disabledUI = container.querySelector('.jasmine-disabled');
|
const disabledUI = container.querySelector('.jasmine-disabled');
|
||||||
expect(disabledUI.checked).toBe(true);
|
expect(disabledUI.checked).toBe(true);
|
||||||
|
|
||||||
|
disabledUI.click();
|
||||||
|
expect(navigateHandler).toHaveBeenCalledWith('hideDisabled', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not display specs that have been disabled', function() {
|
it('should not display specs that have been disabled', function() {
|
||||||
@@ -946,6 +957,7 @@ describe('HtmlReporter', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UI for running tests in random order', function() {
|
describe('UI for running tests in random order', function() {
|
||||||
it('should be unchecked if not randomizing', function() {
|
it('should be unchecked if not randomizing', function() {
|
||||||
const container = document.createElement('div'),
|
const container = document.createElement('div'),
|
||||||
@@ -1068,6 +1080,34 @@ describe('HtmlReporter', function() {
|
|||||||
expect(seedBar).toBeNull();
|
expect(seedBar).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('includes the number of specs in the text of the jasmine-skipped link', function() {
|
||||||
|
const container = document.createElement('div');
|
||||||
|
const reporter = new jasmineUnderTest.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
getContainer: function() {
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
addToExistingQueryString: function(key, value) {
|
||||||
|
return '?foo=bar&' + key + '=' + value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reporter.initialize();
|
||||||
|
const minimalSpecDone = {
|
||||||
|
failedExpectations: [],
|
||||||
|
passedExpectations: []
|
||||||
|
};
|
||||||
|
|
||||||
|
reporter.jasmineStarted({ totalSpecsDefined: 3 });
|
||||||
|
reporter.specDone({ ...minimalSpecDone });
|
||||||
|
reporter.specDone({ ...minimalSpecDone });
|
||||||
|
reporter.specDone({ ...minimalSpecDone, status: 'excluded' });
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
|
const skippedLink = container.querySelector('.jasmine-skipped a');
|
||||||
|
expect(skippedLink.textContent).toEqual('Ran 2 of 3 specs - run all');
|
||||||
|
});
|
||||||
|
|
||||||
it('should include non-spec query params in the jasmine-skipped link when present', function() {
|
it('should include non-spec query params in the jasmine-skipped link when present', function() {
|
||||||
const container = document.createElement('div'),
|
const container = document.createElement('div'),
|
||||||
reporter = new jasmineUnderTest.HtmlReporter({
|
reporter = new jasmineUnderTest.HtmlReporter({
|
||||||
|
|||||||
@@ -695,6 +695,25 @@ describe('HtmlReporterV2', function() {
|
|||||||
expect(seedBar).toBeNull();
|
expect(seedBar).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('includes the number of specs in the text of the jasmine-skipped link', function() {
|
||||||
|
const reporter = setup();
|
||||||
|
|
||||||
|
reporter.initialize();
|
||||||
|
const minimalSpecDone = {
|
||||||
|
failedExpectations: [],
|
||||||
|
passedExpectations: []
|
||||||
|
};
|
||||||
|
|
||||||
|
reporter.jasmineStarted({ totalSpecsDefined: 3 });
|
||||||
|
reporter.specDone({ ...minimalSpecDone });
|
||||||
|
reporter.specDone({ ...minimalSpecDone });
|
||||||
|
reporter.specDone({ ...minimalSpecDone, status: 'excluded' });
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
|
const skippedLink = container.querySelector('.jasmine-skipped a');
|
||||||
|
expect(skippedLink.textContent).toEqual('Ran 2 of 3 specs - run all');
|
||||||
|
});
|
||||||
|
|
||||||
it('should include non-spec query params in the jasmine-skipped link when present', function() {
|
it('should include non-spec query params in the jasmine-skipped link when present', function() {
|
||||||
const reporter = setup({
|
const reporter = setup({
|
||||||
addToExistingQueryString: function(key, value) {
|
addToExistingQueryString: function(key, value) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addSkipped(numExecuted, numDefined) {
|
addSkipped(numExecuted, numDefined) {
|
||||||
// TODO: backfill tests for this
|
|
||||||
this.add(
|
this.add(
|
||||||
'jasmine-bar jasmine-skipped',
|
'jasmine-bar jasmine-skipped',
|
||||||
createDom(
|
createDom(
|
||||||
@@ -65,7 +64,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|||||||
this.add(errorBarClassName, this.#globalFailureMessage(failure));
|
this.add(errorBarClassName, this.#globalFailureMessage(failure));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO check test coverage
|
|
||||||
addSeedBar(doneResult, stateBuilder, order) {
|
addSeedBar(doneResult, stateBuilder, order) {
|
||||||
let statusBarMessage = '';
|
let statusBarMessage = '';
|
||||||
let statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
let statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
||||||
@@ -117,7 +115,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|||||||
this.add(statusBarClassName, [statusBarMessage, seedBar]);
|
this.add(statusBarClassName, [statusBarMessage, seedBar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO check test coverage
|
|
||||||
#globalFailureMessage(failure) {
|
#globalFailureMessage(failure) {
|
||||||
if (failure.globalErrorType === 'load') {
|
if (failure.globalErrorType === 'load') {
|
||||||
const prefix = 'Error during loading: ' + failure.message;
|
const prefix = 'Error during loading: ' + failure.message;
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ jasmineRequire.Banner = function(j$) {
|
|||||||
'#jasmine-hide-disabled'
|
'#jasmine-hide-disabled'
|
||||||
);
|
);
|
||||||
hideDisabled.checked = config.hideDisabled;
|
hideDisabled.checked = config.hideDisabled;
|
||||||
// TODO: backfill tests for this!
|
|
||||||
hideDisabled.onclick = () => {
|
hideDisabled.onclick = () => {
|
||||||
this.#navigateWithNewParam('hideDisabled', !config.hideDisabled);
|
this.#navigateWithNewParam('hideDisabled', !config.hideDisabled);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user