Merge branch 'hide-grey-specs' of https://github.com/SamFare/jasmine into SamFare-hide-grey-specs
- Merges #1561 from @SamFare
This commit is contained in:
@@ -78,6 +78,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||
|
||||
var hideDisabled = queryString.getParam("hideDisabled");
|
||||
env.hideDisabled(hideDisabled);
|
||||
|
||||
var random = queryString.getParam("random");
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
|
||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||
|
||||
var hideDisabled = queryString.getParam("hideDisabled");
|
||||
env.hideDisabled(hideDisabled);
|
||||
|
||||
var random = queryString.getParam("random");
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
symbols.appendChild(createDom('li', {
|
||||
className: noExpectations(result) ? 'jasmine-empty' : 'jasmine-' + result.status,
|
||||
className: this.displaySpecInCorrectFormat(result),
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
}
|
||||
@@ -161,6 +161,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
addDeprecationWarnings(result);
|
||||
};
|
||||
|
||||
this.displaySpecInCorrectFormat = function(result) {
|
||||
return noExpectations(result) ? 'jasmine-empty' : this.resultStatus(result.status);
|
||||
};
|
||||
|
||||
this.resultStatus = function(status) {
|
||||
if(status === 'excluded') {
|
||||
return env.hidingDisabled() ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
|
||||
}
|
||||
return 'jasmine-' + status;
|
||||
};
|
||||
|
||||
this.jasmineDone = function(doneResult) {
|
||||
var banner = find('.jasmine-banner');
|
||||
var alert = find('.jasmine-alert');
|
||||
@@ -352,7 +363,14 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
id: 'jasmine-random-order',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order')),
|
||||
createDom('div', { className: 'jasmine-hide-disabled' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-disabled',
|
||||
id: 'jasmine-hide-disabled',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-hide-disabled' }, 'hide disabled tests'))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -374,6 +392,12 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
navigateWithNewParam('random', !env.randomTests());
|
||||
};
|
||||
|
||||
var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled');
|
||||
hideDisabled.checked = env.hidingDisabled();
|
||||
hideDisabled.onclick = function() {
|
||||
navigateWithNewParam('hideDisabled', !env.hidingDisabled());
|
||||
};
|
||||
|
||||
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
|
||||
optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
|
||||
isOpen = /\bjasmine-open\b/;
|
||||
|
||||
@@ -20,6 +20,7 @@ body { overflow-y: scroll; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed:before { color: #ca3a11; content: "\d7"; font-weight: bold; margin-left: -1px; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded { font-size: 14px; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded:before { color: #bababa; content: "\02022"; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded-no-display { font-size: 14px; display: none; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending { line-height: 17px; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending:before { color: #ba9d37; content: "*"; }
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty { font-size: 14px; }
|
||||
|
||||
@@ -791,6 +791,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var throwOnExpectationFailure = false;
|
||||
var stopOnSpecFailure = false;
|
||||
var random = true;
|
||||
var hidingDisabled = false;
|
||||
var seed = null;
|
||||
var handlingLoadErrors = true;
|
||||
var hasFailures = false;
|
||||
@@ -959,6 +960,14 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
random = !!value;
|
||||
};
|
||||
|
||||
this.hidingDisabled = function(value) {
|
||||
return hidingDisabled;
|
||||
};
|
||||
|
||||
this.hideDisabled = function(value) {
|
||||
hidingDisabled = !!value;
|
||||
};
|
||||
|
||||
this.randomTests = function() {
|
||||
return random;
|
||||
};
|
||||
|
||||
@@ -103,7 +103,6 @@ describe("HtmlReporter", function() {
|
||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
||||
});
|
||||
reporter.initialize();
|
||||
|
||||
reporter.specDone({id: 789, status: "excluded", fullName: "symbols should have titles", passedExpectations: [], failedExpectations: []});
|
||||
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
@@ -696,7 +695,85 @@ describe("HtmlReporter", function() {
|
||||
expect(navigateHandler).toHaveBeenCalledWith('throwFailures', false);
|
||||
});
|
||||
});
|
||||
describe("UI for hiding disabled specs", function() {
|
||||
it("should be unchecked if not hiding disabled specs", 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);
|
||||
}
|
||||
});
|
||||
|
||||
env.hideDisabled(false);
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var disabledUI = container.querySelector(".jasmine-disabled");
|
||||
expect(disabledUI.checked).toBe(false);
|
||||
});
|
||||
|
||||
it("should be checked if hiding disabled", 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);
|
||||
}
|
||||
});
|
||||
|
||||
env.hideDisabled(true);
|
||||
reporter.initialize();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
var disabledUI = container.querySelector(".jasmine-disabled");
|
||||
expect(disabledUI.checked).toBe(true);
|
||||
});
|
||||
|
||||
it("should not display specs that have been disabled", 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); }
|
||||
});
|
||||
env.hideDisabled(true);
|
||||
reporter.initialize();
|
||||
reporter.specDone({
|
||||
id: 789,
|
||||
status: "excluded",
|
||||
fullName: "symbols should have titles",
|
||||
passedExpectations: [],
|
||||
failedExpectations: []
|
||||
});
|
||||
|
||||
|
||||
|
||||
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||
expect(specEl.getAttribute("class")).toEqual("jasmine-excluded-no-display");
|
||||
});
|
||||
});
|
||||
describe("UI for running tests in random order", function() {
|
||||
it("should be unchecked if not randomizing", function() {
|
||||
var env = new jasmineUnderTest.Env(),
|
||||
|
||||
@@ -26,6 +26,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var throwOnExpectationFailure = false;
|
||||
var stopOnSpecFailure = false;
|
||||
var random = true;
|
||||
var hidingDisabled = false;
|
||||
var seed = null;
|
||||
var handlingLoadErrors = true;
|
||||
var hasFailures = false;
|
||||
@@ -194,6 +195,14 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
random = !!value;
|
||||
};
|
||||
|
||||
this.hidingDisabled = function(value) {
|
||||
return hidingDisabled;
|
||||
};
|
||||
|
||||
this.hideDisabled = function(value) {
|
||||
hidingDisabled = !!value;
|
||||
};
|
||||
|
||||
this.randomTests = function() {
|
||||
return random;
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
symbols.appendChild(createDom('li', {
|
||||
className: noExpectations(result) ? 'jasmine-empty' : 'jasmine-' + result.status,
|
||||
className: this.displaySpecInCorrectFormat(result),
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
}
|
||||
@@ -132,6 +132,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
addDeprecationWarnings(result);
|
||||
};
|
||||
|
||||
this.displaySpecInCorrectFormat = function(result) {
|
||||
return noExpectations(result) ? 'jasmine-empty' : this.resultStatus(result.status);
|
||||
};
|
||||
|
||||
this.resultStatus = function(status) {
|
||||
if(status === 'excluded') {
|
||||
return env.hidingDisabled() ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
|
||||
}
|
||||
return 'jasmine-' + status;
|
||||
};
|
||||
|
||||
this.jasmineDone = function(doneResult) {
|
||||
var banner = find('.jasmine-banner');
|
||||
var alert = find('.jasmine-alert');
|
||||
@@ -323,7 +334,14 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
id: 'jasmine-random-order',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order')),
|
||||
createDom('div', { className: 'jasmine-hide-disabled' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-disabled',
|
||||
id: 'jasmine-hide-disabled',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-hide-disabled' }, 'hide disabled tests'))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -345,6 +363,12 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
navigateWithNewParam('random', !env.randomTests());
|
||||
};
|
||||
|
||||
var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled');
|
||||
hideDisabled.checked = env.hidingDisabled();
|
||||
hideDisabled.onclick = function() {
|
||||
navigateWithNewParam('hideDisabled', !env.hidingDisabled());
|
||||
};
|
||||
|
||||
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
|
||||
optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
|
||||
isOpen = /\bjasmine-open\b/;
|
||||
|
||||
@@ -135,7 +135,7 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
&.jasmine-excluded {
|
||||
&.jasmine-excluded {
|
||||
font-size: 14px;
|
||||
|
||||
&:before {
|
||||
@@ -144,6 +144,11 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
&.jasmine-excluded-no-display {
|
||||
font-size: 14px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.jasmine-pending {
|
||||
line-height: 17px;
|
||||
&:before {
|
||||
@@ -294,7 +299,7 @@ body {
|
||||
|
||||
&.jasmine-excluded a {
|
||||
color: $neutral-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user