From e60f22a2e5e4d1ad54bb706993b32ccad314de59 Mon Sep 17 00:00:00 2001 From: Lee Byrd & Christian Williams Date: Tue, 22 Jun 2010 14:48:47 -0700 Subject: [PATCH] Changed 'type' field of MessageResult and ExpectationResult to 'log' and 'expect', respectively. --- lib/TrivialReporter.js | 4 ++-- lib/jasmine-0.10.4.js | 13 ++++++++----- spec/suites/JsApiReporterSpec.js | 4 ++-- spec/suites/TrivialReporterSpec.js | 1 - src/JsApiReporter.js | 2 +- src/NestedResults.js | 2 +- src/Spec.js | 3 +++ src/base.js | 4 ++-- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 9abd667..6bee4ab 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -135,9 +135,9 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { for (var i = 0; i < resultItems.length; i++) { var result = resultItems[i]; - if (result.type == 'MessageResult') { + if (result.type == 'log') { 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)); if (result.trace.stack) { diff --git a/lib/jasmine-0.10.4.js b/lib/jasmine-0.10.4.js index 1511619..6c16a0e 100644 --- a/lib/jasmine-0.10.4.js +++ b/lib/jasmine-0.10.4.js @@ -52,7 +52,7 @@ jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval'); jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval'); jasmine.MessageResult = function(values) { - this.type = 'MessageResult'; + this.type = 'log'; this.values = values; this.trace = new Error(); // todo: test better }; @@ -71,7 +71,7 @@ jasmine.MessageResult.prototype.toString = function() { }; jasmine.ExpectationResult = function(params) { - this.type = 'ExpectationResult'; + this.type = 'expect'; this.matcherName = params.matcherName; this.passed_ = params.passed; this.expected = params.expected; @@ -1059,7 +1059,7 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { var resultMessage = result.messages[messageIndex]; summaryMessages.push({ - text: resultMessage.type == 'MessageResult' ? resultMessage.toString() : jasmine.undefined, + text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, passed: resultMessage.passed ? resultMessage.passed() : true, type: resultMessage.type, message: resultMessage.message, @@ -1498,7 +1498,7 @@ jasmine.NestedResults.prototype.getItems = function() { * @param {jasmine.ExpectationResult|jasmine.NestedResults} result */ jasmine.NestedResults.prototype.addResult = function(result) { - if (result.type != 'MessageResult') { + if (result.type != 'log') { if (result.items_) { this.rollupCounts(result); } else { @@ -1917,6 +1917,9 @@ jasmine.Spec.prototype.addToQueue = function (block) { } }; +/** + * @param {jasmine.ExpectationResult} result + */ jasmine.Spec.prototype.addMatcherResult = function(result) { this.results_.addResult(result); }; @@ -2375,5 +2378,5 @@ jasmine.version_= { "major": 0, "minor": 10, "build": 4, - "revision": 1277234552 + "revision": 1277243292 }; diff --git a/spec/suites/JsApiReporterSpec.js b/spec/suites/JsApiReporterSpec.js index 2437e46..f22e645 100644 --- a/spec/suites/JsApiReporterSpec.js +++ b/spec/suites/JsApiReporterSpec.js @@ -79,7 +79,7 @@ describe('jasmine.jsApiReporter', function() { expect(summarizedResult.messages.length).toEqual(1); expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message); 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].trace.stack).toBeUndefined(); }); @@ -95,7 +95,7 @@ describe('jasmine.jsApiReporter', function() { var result = reporter.results()[spec3.id]; var summarizedResult = reporter.summarizeResult_(result); 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'); }); }); diff --git a/spec/suites/TrivialReporterSpec.js b/spec/suites/TrivialReporterSpec.js index 23cc314..87f42ce 100644 --- a/spec/suites/TrivialReporterSpec.js +++ b/spec/suites/TrivialReporterSpec.js @@ -24,7 +24,6 @@ describe("TrivialReporter", function() { function findElements(divs, withClass) { var els = []; for (var i = 0; i < divs.length; i++) { - console.log(divs[i], divs[i].className); if (divs[i].className == withClass) els.push(divs[i]); } return els; diff --git a/src/JsApiReporter.js b/src/JsApiReporter.js index f897839..44f1802 100644 --- a/src/JsApiReporter.js +++ b/src/JsApiReporter.js @@ -84,7 +84,7 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { var resultMessage = result.messages[messageIndex]; summaryMessages.push({ - text: resultMessage.type == 'MessageResult' ? resultMessage.toString() : jasmine.undefined, + text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, passed: resultMessage.passed ? resultMessage.passed() : true, type: resultMessage.type, message: resultMessage.message, diff --git a/src/NestedResults.js b/src/NestedResults.js index 461c133..374e5e4 100644 --- a/src/NestedResults.js +++ b/src/NestedResults.js @@ -57,7 +57,7 @@ jasmine.NestedResults.prototype.getItems = function() { * @param {jasmine.ExpectationResult|jasmine.NestedResults} result */ jasmine.NestedResults.prototype.addResult = function(result) { - if (result.type != 'MessageResult') { + if (result.type != 'log') { if (result.items_) { this.rollupCounts(result); } else { diff --git a/src/Spec.js b/src/Spec.js index 8e074b6..c74a2e2 100644 --- a/src/Spec.js +++ b/src/Spec.js @@ -60,6 +60,9 @@ jasmine.Spec.prototype.addToQueue = function (block) { } }; +/** + * @param {jasmine.ExpectationResult} result + */ jasmine.Spec.prototype.addMatcherResult = function(result) { this.results_.addResult(result); }; diff --git a/src/base.js b/src/base.js index f373aa5..e066b97 100755 --- a/src/base.js +++ b/src/base.js @@ -52,7 +52,7 @@ jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval'); jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval'); jasmine.MessageResult = function(values) { - this.type = 'MessageResult'; + this.type = 'log'; this.values = values; this.trace = new Error(); // todo: test better }; @@ -71,7 +71,7 @@ jasmine.MessageResult.prototype.toString = function() { }; jasmine.ExpectationResult = function(params) { - this.type = 'ExpectationResult'; + this.type = 'expect'; this.matcherName = params.matcherName; this.passed_ = params.passed; this.expected = params.expected;