Changed 'type' field of MessageResult and ExpectationResult to 'log' and 'expect', respectively.
This commit is contained in:
parent
e7cd6a473a
commit
e60f22a2e5
|
@ -135,9 +135,9 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||||
for (var i = 0; i < resultItems.length; i++) {
|
for (var i = 0; i < resultItems.length; i++) {
|
||||||
var result = resultItems[i];
|
var result = resultItems[i];
|
||||||
|
|
||||||
if (result.type == 'MessageResult') {
|
if (result.type == 'log') {
|
||||||
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
||||||
} else if (result.type == 'ExpectationResult' && result.passed && !result.passed()) {
|
} else if (result.type == 'expect' && result.passed && !result.passed()) {
|
||||||
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
||||||
|
|
||||||
if (result.trace.stack) {
|
if (result.trace.stack) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
|
||||||
jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
|
jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
|
||||||
|
|
||||||
jasmine.MessageResult = function(values) {
|
jasmine.MessageResult = function(values) {
|
||||||
this.type = 'MessageResult';
|
this.type = 'log';
|
||||||
this.values = values;
|
this.values = values;
|
||||||
this.trace = new Error(); // todo: test better
|
this.trace = new Error(); // todo: test better
|
||||||
};
|
};
|
||||||
|
@ -71,7 +71,7 @@ jasmine.MessageResult.prototype.toString = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.ExpectationResult = function(params) {
|
jasmine.ExpectationResult = function(params) {
|
||||||
this.type = 'ExpectationResult';
|
this.type = 'expect';
|
||||||
this.matcherName = params.matcherName;
|
this.matcherName = params.matcherName;
|
||||||
this.passed_ = params.passed;
|
this.passed_ = params.passed;
|
||||||
this.expected = params.expected;
|
this.expected = params.expected;
|
||||||
|
@ -1059,7 +1059,7 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
||||||
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
||||||
var resultMessage = result.messages[messageIndex];
|
var resultMessage = result.messages[messageIndex];
|
||||||
summaryMessages.push({
|
summaryMessages.push({
|
||||||
text: resultMessage.type == 'MessageResult' ? resultMessage.toString() : jasmine.undefined,
|
text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
|
||||||
passed: resultMessage.passed ? resultMessage.passed() : true,
|
passed: resultMessage.passed ? resultMessage.passed() : true,
|
||||||
type: resultMessage.type,
|
type: resultMessage.type,
|
||||||
message: resultMessage.message,
|
message: resultMessage.message,
|
||||||
|
@ -1498,7 +1498,7 @@ jasmine.NestedResults.prototype.getItems = function() {
|
||||||
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
||||||
*/
|
*/
|
||||||
jasmine.NestedResults.prototype.addResult = function(result) {
|
jasmine.NestedResults.prototype.addResult = function(result) {
|
||||||
if (result.type != 'MessageResult') {
|
if (result.type != 'log') {
|
||||||
if (result.items_) {
|
if (result.items_) {
|
||||||
this.rollupCounts(result);
|
this.rollupCounts(result);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1917,6 +1917,9 @@ jasmine.Spec.prototype.addToQueue = function (block) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {jasmine.ExpectationResult} result
|
||||||
|
*/
|
||||||
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
||||||
this.results_.addResult(result);
|
this.results_.addResult(result);
|
||||||
};
|
};
|
||||||
|
@ -2375,5 +2378,5 @@ jasmine.version_= {
|
||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 10,
|
"minor": 10,
|
||||||
"build": 4,
|
"build": 4,
|
||||||
"revision": 1277234552
|
"revision": 1277243292
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,7 +79,7 @@ describe('jasmine.jsApiReporter', function() {
|
||||||
expect(summarizedResult.messages.length).toEqual(1);
|
expect(summarizedResult.messages.length).toEqual(1);
|
||||||
expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message);
|
expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message);
|
||||||
expect(summarizedResult.messages[0].passed).toBeTruthy();
|
expect(summarizedResult.messages[0].passed).toBeTruthy();
|
||||||
expect(summarizedResult.messages[0].type).toEqual('ExpectationResult');
|
expect(summarizedResult.messages[0].type).toEqual('expect');
|
||||||
expect(summarizedResult.messages[0].text).toBeUndefined();
|
expect(summarizedResult.messages[0].text).toBeUndefined();
|
||||||
expect(summarizedResult.messages[0].trace.stack).toBeUndefined();
|
expect(summarizedResult.messages[0].trace.stack).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
@ -95,7 +95,7 @@ describe('jasmine.jsApiReporter', function() {
|
||||||
var result = reporter.results()[spec3.id];
|
var result = reporter.results()[spec3.id];
|
||||||
var summarizedResult = reporter.summarizeResult_(result);
|
var summarizedResult = reporter.summarizeResult_(result);
|
||||||
expect(summarizedResult.result).toEqual('passed');
|
expect(summarizedResult.result).toEqual('passed');
|
||||||
expect(summarizedResult.messages[0].type).toEqual('MessageResult');
|
expect(summarizedResult.messages[0].type).toEqual('log');
|
||||||
expect(summarizedResult.messages[0].text).toEqual('some debug message');
|
expect(summarizedResult.messages[0].text).toEqual('some debug message');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,6 @@ describe("TrivialReporter", function() {
|
||||||
function findElements(divs, withClass) {
|
function findElements(divs, withClass) {
|
||||||
var els = [];
|
var els = [];
|
||||||
for (var i = 0; i < divs.length; i++) {
|
for (var i = 0; i < divs.length; i++) {
|
||||||
console.log(divs[i], divs[i].className);
|
|
||||||
if (divs[i].className == withClass) els.push(divs[i]);
|
if (divs[i].className == withClass) els.push(divs[i]);
|
||||||
}
|
}
|
||||||
return els;
|
return els;
|
||||||
|
|
|
@ -84,7 +84,7 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
||||||
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
||||||
var resultMessage = result.messages[messageIndex];
|
var resultMessage = result.messages[messageIndex];
|
||||||
summaryMessages.push({
|
summaryMessages.push({
|
||||||
text: resultMessage.type == 'MessageResult' ? resultMessage.toString() : jasmine.undefined,
|
text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
|
||||||
passed: resultMessage.passed ? resultMessage.passed() : true,
|
passed: resultMessage.passed ? resultMessage.passed() : true,
|
||||||
type: resultMessage.type,
|
type: resultMessage.type,
|
||||||
message: resultMessage.message,
|
message: resultMessage.message,
|
||||||
|
|
|
@ -57,7 +57,7 @@ jasmine.NestedResults.prototype.getItems = function() {
|
||||||
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
||||||
*/
|
*/
|
||||||
jasmine.NestedResults.prototype.addResult = function(result) {
|
jasmine.NestedResults.prototype.addResult = function(result) {
|
||||||
if (result.type != 'MessageResult') {
|
if (result.type != 'log') {
|
||||||
if (result.items_) {
|
if (result.items_) {
|
||||||
this.rollupCounts(result);
|
this.rollupCounts(result);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -60,6 +60,9 @@ jasmine.Spec.prototype.addToQueue = function (block) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {jasmine.ExpectationResult} result
|
||||||
|
*/
|
||||||
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
||||||
this.results_.addResult(result);
|
this.results_.addResult(result);
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,7 @@ jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
|
||||||
jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
|
jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
|
||||||
|
|
||||||
jasmine.MessageResult = function(values) {
|
jasmine.MessageResult = function(values) {
|
||||||
this.type = 'MessageResult';
|
this.type = 'log';
|
||||||
this.values = values;
|
this.values = values;
|
||||||
this.trace = new Error(); // todo: test better
|
this.trace = new Error(); // todo: test better
|
||||||
};
|
};
|
||||||
|
@ -71,7 +71,7 @@ jasmine.MessageResult.prototype.toString = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.ExpectationResult = function(params) {
|
jasmine.ExpectationResult = function(params) {
|
||||||
this.type = 'ExpectationResult';
|
this.type = 'expect';
|
||||||
this.matcherName = params.matcherName;
|
this.matcherName = params.matcherName;
|
||||||
this.passed_ = params.passed;
|
this.passed_ = params.passed;
|
||||||
this.expected = params.expected;
|
this.expected = params.expected;
|
||||||
|
|
Loading…
Reference in New Issue