This is an automated email from the git hooks/post-receive script. sylvestre pushed a commit to branch master in repository jscover.
commit 365a25be01d116c982817dbc2083af880a6d2ffa Author: tntim96 <[email protected]> Date: Sun Jul 27 08:14:30 2014 +1000 Upgrade to Jasmine 2.0.1 --- History.md | 1 + src/test/javascript/lib/jasmine-2.0.0/jasmine.css | 55 -- .../lib/jasmine-2.0.0/jasmine_favicon.png | Bin 2057 -> 0 bytes .../lib/{jasmine-2.0.0 => jasmine-2.0.1}/boot.js | 0 .../{jasmine-2.0.0 => jasmine-2.0.1}/console.js | 49 +- .../jasmine-html.js | 177 +++--- src/test/javascript/lib/jasmine-2.0.1/jasmine.css | 59 ++ .../{jasmine-2.0.0 => jasmine-2.0.1}/jasmine.js | 622 ++++++++++++--------- .../lib/jasmine-2.0.1/jasmine_favicon.png | Bin 0 -> 1486 bytes src/test/javascript/spec/suite.html | 12 +- 10 files changed, 565 insertions(+), 410 deletions(-) diff --git a/History.md b/History.md index 5e5fb52..93bcf0b 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ 1.0.14 / 2014-??-?? ================== * Decode URI in proxy mode + * Internal: Upgrade to Jasmine 2.0.1 1.0.13 / 2014-07-08 ================== diff --git a/src/test/javascript/lib/jasmine-2.0.0/jasmine.css b/src/test/javascript/lib/jasmine-2.0.0/jasmine.css deleted file mode 100644 index f4d35b6..0000000 --- a/src/test/javascript/lib/jasmine-2.0.0/jasmine.css +++ /dev/null @@ -1,55 +0,0 @@ -body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; } - -.html-reporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } -.html-reporter a { text-decoration: none; } -.html-reporter a:hover { text-decoration: underline; } -.html-reporter p, .html-reporter h1, .html-reporter h2, .html-reporter h3, .html-reporter h4, .html-reporter h5, .html-reporter h6 { margin: 0; line-height: 14px; } -.html-reporter .banner, .html-reporter .symbol-summary, .html-reporter .summary, .html-reporter .result-message, .html-reporter .spec .description, .html-reporter .spec-detail .description, .html-reporter .alert .bar, .html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; } -.html-reporter .banner .version { margin-left: 14px; } -.html-reporter #jasmine_content { position: fixed; right: 100%; } -.html-reporter .version { color: #aaaaaa; } -.html-reporter .banner { margin-top: 14px; } -.html-reporter .duration { color: #aaaaaa; float: right; } -.html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; } -.html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; } -.html-reporter .symbol-summary li.passed { font-size: 14px; } -.html-reporter .symbol-summary li.passed:before { color: #5e7d00; content: "\02022"; } -.html-reporter .symbol-summary li.failed { line-height: 9px; } -.html-reporter .symbol-summary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; } -.html-reporter .symbol-summary li.disabled { font-size: 14px; } -.html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; } -.html-reporter .symbol-summary li.pending { line-height: 17px; } -.html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; } -.html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; } -.html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } -.html-reporter .bar.failed { background-color: #b03911; } -.html-reporter .bar.passed { background-color: #a6b779; } -.html-reporter .bar.skipped { background-color: #bababa; } -.html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; } -.html-reporter .bar.menu a { color: #333333; } -.html-reporter .bar a { color: white; } -.html-reporter.spec-list .bar.menu.failure-list, .html-reporter.spec-list .results .failures { display: none; } -.html-reporter.failure-list .bar.menu.spec-list, .html-reporter.failure-list .summary { display: none; } -.html-reporter .running-alert { background-color: #666666; } -.html-reporter .results { margin-top: 14px; } -.html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } -.html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } -.html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } -.html-reporter.showDetails .summary { display: none; } -.html-reporter.showDetails #details { display: block; } -.html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } -.html-reporter .summary { margin-top: 14px; } -.html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; } -.html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; } -.html-reporter .summary li.passed a { color: #5e7d00; } -.html-reporter .summary li.failed a { color: #b03911; } -.html-reporter .summary li.pending a { color: #ba9d37; } -.html-reporter .description + .suite { margin-top: 0; } -.html-reporter .suite { margin-top: 14px; } -.html-reporter .suite a { color: #333333; } -.html-reporter .failures .spec-detail { margin-bottom: 28px; } -.html-reporter .failures .spec-detail .description { background-color: #b03911; } -.html-reporter .failures .spec-detail .description a { color: white; } -.html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; } -.html-reporter .result-message span.result { display: block; } -.html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } diff --git a/src/test/javascript/lib/jasmine-2.0.0/jasmine_favicon.png b/src/test/javascript/lib/jasmine-2.0.0/jasmine_favicon.png deleted file mode 100644 index 3562e27..0000000 Binary files a/src/test/javascript/lib/jasmine-2.0.0/jasmine_favicon.png and /dev/null differ diff --git a/src/test/javascript/lib/jasmine-2.0.0/boot.js b/src/test/javascript/lib/jasmine-2.0.1/boot.js similarity index 100% rename from src/test/javascript/lib/jasmine-2.0.0/boot.js rename to src/test/javascript/lib/jasmine-2.0.1/boot.js diff --git a/src/test/javascript/lib/jasmine-2.0.0/console.js b/src/test/javascript/lib/jasmine-2.0.1/console.js similarity index 77% rename from src/test/javascript/lib/jasmine-2.0.0/console.js rename to src/test/javascript/lib/jasmine-2.0.1/console.js index 33c1698..c54f72d 100644 --- a/src/test/javascript/lib/jasmine-2.0.0/console.js +++ b/src/test/javascript/lib/jasmine-2.0.1/console.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2013 Pivotal Labs +Copyright (c) 2008-2014 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ function getJasmineRequireObj() { - if (typeof module !== "undefined" && module.exports) { + if (typeof module !== 'undefined' && module.exports) { return exports; } else { window.jasmineRequire = window.jasmineRequire || {}; @@ -60,7 +60,7 @@ getJasmineRequireObj().ConsoleReporter = function() { specCount = 0; failureCount = 0; pendingCount = 0; - print("Started"); + print('Started'); printNewline(); timer.start(); }; @@ -71,19 +71,24 @@ getJasmineRequireObj().ConsoleReporter = function() { specFailureDetails(failedSpecs[i]); } - printNewline(); - var specCounts = specCount + " " + plural("spec", specCount) + ", " + - failureCount + " " + plural("failure", failureCount); + if(specCount > 0) { + printNewline(); - if (pendingCount) { - specCounts += ", " + pendingCount + " pending " + plural("spec", pendingCount); - } + var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' + + failureCount + ' ' + plural('failure', failureCount); - print(specCounts); + if (pendingCount) { + specCounts += ', ' + pendingCount + ' pending ' + plural('spec', pendingCount); + } + + print(specCounts); + } else { + print('No specs found'); + } printNewline(); var seconds = timer.elapsed() / 1000; - print("Finished in " + seconds + " " + plural("second", seconds)); + print('Finished in ' + seconds + ' ' + plural('second', seconds)); printNewline(); @@ -93,28 +98,28 @@ getJasmineRequireObj().ConsoleReporter = function() { this.specDone = function(result) { specCount++; - if (result.status == "pending") { + if (result.status == 'pending') { pendingCount++; - print(colored("yellow", "*")); + print(colored('yellow', '*')); return; } - if (result.status == "passed") { - print(colored("green", '.')); + if (result.status == 'passed') { + print(colored('green', '.')); return; } - if (result.status == "failed") { + if (result.status == 'failed') { failureCount++; failedSpecs.push(result); - print(colored("red", 'F')); + print(colored('red', 'F')); } }; return this; function printNewline() { - print("\n"); + print('\n'); } function colored(color, str) { @@ -122,7 +127,7 @@ getJasmineRequireObj().ConsoleReporter = function() { } function plural(str, count) { - return count == 1 ? str : str + "s"; + return count == 1 ? str : str + 's'; } function repeat(thing, times) { @@ -134,12 +139,12 @@ getJasmineRequireObj().ConsoleReporter = function() { } function indent(str, spaces) { - var lines = (str || '').split("\n"); + var lines = (str || '').split('\n'); var newArr = []; for (var i = 0; i < lines.length; i++) { - newArr.push(repeat(" ", spaces).join("") + lines[i]); + newArr.push(repeat(' ', spaces).join('') + lines[i]); } - return newArr.join("\n"); + return newArr.join('\n'); } function specFailureDetails(result) { diff --git a/src/test/javascript/lib/jasmine-2.0.0/jasmine-html.js b/src/test/javascript/lib/jasmine-2.0.1/jasmine-html.js similarity index 56% rename from src/test/javascript/lib/jasmine-2.0.0/jasmine-html.js rename to src/test/javascript/lib/jasmine-2.0.1/jasmine-html.js index 985d0d1..9d95903 100644 --- a/src/test/javascript/lib/jasmine-2.0.0/jasmine-html.js +++ b/src/test/javascript/lib/jasmine-2.0.1/jasmine-html.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2013 Pivotal Labs +Copyright (c) 2008-2014 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -49,20 +49,21 @@ jasmineRequire.HtmlReporter = function(j$) { symbols; this.initialize = function() { - htmlReporterMain = createDom("div", {className: "html-reporter"}, - createDom("div", {className: "banner"}, - createDom("span", {className: "title"}, "Jasmine"), - createDom("span", {className: "version"}, j$.version) + clearPrior(); + htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'}, + createDom('div', {className: 'banner'}, + createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}), + createDom('span', {className: 'version'}, j$.version) ), - createDom("ul", {className: "symbol-summary"}), - createDom("div", {className: "alert"}), - createDom("div", {className: "results"}, - createDom("div", {className: "failures"}) + createDom('ul', {className: 'symbol-summary'}), + createDom('div', {className: 'alert'}), + createDom('div', {className: 'results'}, + createDom('div', {className: 'failures'}) ) ); getContainer().appendChild(htmlReporterMain); - symbols = find(".symbol-summary"); + symbols = find('.symbol-summary'); }; var totalSpecsDefined; @@ -71,13 +72,13 @@ jasmineRequire.HtmlReporter = function(j$) { timer.start(); }; - var summary = createDom("div", {className: "summary"}); + var summary = createDom('div', {className: 'summary'}); - var topResults = new j$.ResultsNode({}, "", null), + var topResults = new j$.ResultsNode({}, '', null), currentParent = topResults; this.suiteStarted = function(result) { - currentParent.addChild(result, "suite"); + currentParent.addChild(result, 'suite'); currentParent = currentParent.last(); }; @@ -90,82 +91,94 @@ jasmineRequire.HtmlReporter = function(j$) { }; this.specStarted = function(result) { - currentParent.addChild(result, "spec"); + currentParent.addChild(result, 'spec'); }; var failures = []; this.specDone = function(result) { - if (result.status != "disabled") { + if(noExpectations(result) && console && console.error) { + console.error('Spec \'' + result.fullName + '\' has no expectations.'); + } + + if (result.status != 'disabled') { specsExecuted++; } - symbols.appendChild(createDom("li", { - className: result.status, - id: "spec_" + result.id, + symbols.appendChild(createDom('li', { + className: noExpectations(result) ? 'empty' : result.status, + id: 'spec_' + result.id, title: result.fullName } )); - if (result.status == "failed") { + if (result.status == 'failed') { failureCount++; var failure = - createDom("div", {className: "spec-detail failed"}, - createDom("div", {className: "description"}, - createDom("a", {title: result.fullName, href: specHref(result)}, result.fullName) + createDom('div', {className: 'spec-detail failed'}, + createDom('div', {className: 'description'}, + createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName) ), - createDom("div", {className: "messages"}) + createDom('div', {className: 'messages'}) ); var messages = failure.childNodes[1]; for (var i = 0; i < result.failedExpectations.length; i++) { var expectation = result.failedExpectations[i]; - messages.appendChild(createDom("div", {className: "result-message"}, expectation.message)); - messages.appendChild(createDom("div", {className: "stack-trace"}, expectation.stack)); + messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message)); + messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack)); } failures.push(failure); } - if (result.status == "pending") { + if (result.status == 'pending') { pendingSpecCount++; } }; this.jasmineDone = function() { - var banner = find(".banner"); - banner.appendChild(createDom("span", {className: "duration"}, "finished in " + timer.elapsed() / 1000 + "s")); + var banner = find('.banner'); + banner.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's')); - var alert = find(".alert"); + var alert = find('.alert'); - alert.appendChild(createDom("span", { className: "exceptions" }, - createDom("label", { className: "label", 'for': "raise-exceptions" }, "raise exceptions"), - createDom("input", { - className: "raise", - id: "raise-exceptions", - type: "checkbox" + alert.appendChild(createDom('span', { className: 'exceptions' }, + createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'), + createDom('input', { + className: 'raise', + id: 'raise-exceptions', + type: 'checkbox' }) )); - var checkbox = find("input"); + var checkbox = find('#raise-exceptions'); checkbox.checked = !env.catchingExceptions(); checkbox.onclick = onRaiseExceptionsClick; if (specsExecuted < totalSpecsDefined) { - var skippedMessage = "Ran " + specsExecuted + " of " + totalSpecsDefined + " specs - run all"; + var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all'; alert.appendChild( - createDom("span", {className: "bar skipped"}, - createDom("a", {href: "?", title: "Run all specs"}, skippedMessage) + createDom('span', {className: 'bar skipped'}, + createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage) ) ); } - var statusBarMessage = "" + pluralize("spec", specsExecuted) + ", " + pluralize("failure", failureCount); - if (pendingSpecCount) { statusBarMessage += ", " + pluralize("pending spec", pendingSpecCount); } + var statusBarMessage = ''; + var statusBarClassName = 'bar '; + + if (totalSpecsDefined > 0) { + statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount); + if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); } + statusBarClassName += (failureCount > 0) ? 'failed' : 'passed'; + } else { + statusBarClassName += 'skipped'; + statusBarMessage += 'No specs found'; + } - var statusBarClassName = "bar " + ((failureCount > 0) ? "failed" : "passed"); - alert.appendChild(createDom("span", {className: statusBarClassName}, statusBarMessage)); + alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage)); - var results = find(".results"); + var results = find('.results'); results.appendChild(summary); summaryList(topResults, summary); @@ -174,27 +187,31 @@ jasmineRequire.HtmlReporter = function(j$) { var specListNode; for (var i = 0; i < resultsTree.children.length; i++) { var resultNode = resultsTree.children[i]; - if (resultNode.type == "suite") { - var suiteListNode = createDom("ul", {className: "suite", id: "suite-" + resultNode.result.id}, - createDom("li", {className: "suite-detail"}, - createDom("a", {href: specHref(resultNode.result)}, resultNode.result.description) + if (resultNode.type == 'suite') { + var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id}, + createDom('li', {className: 'suite-detail'}, + createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description) ) ); summaryList(resultNode, suiteListNode); domParent.appendChild(suiteListNode); } - if (resultNode.type == "spec") { - if (domParent.getAttribute("class") != "specs") { - specListNode = createDom("ul", {className: "specs"}); + if (resultNode.type == 'spec') { + if (domParent.getAttribute('class') != 'specs') { + specListNode = createDom('ul', {className: 'specs'}); domParent.appendChild(specListNode); } + var specDescription = resultNode.result.description; + if(noExpectations(resultNode.result)) { + specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription; + } specListNode.appendChild( - createDom("li", { + createDom('li', { className: resultNode.result.status, - id: "spec-" + resultNode.result.id + id: 'spec-' + resultNode.result.id }, - createDom("a", {href: specHref(resultNode.result)}, resultNode.result.description) + createDom('a', {href: specHref(resultNode.result)}, specDescription) ) ); } @@ -203,24 +220,24 @@ jasmineRequire.HtmlReporter = function(j$) { if (failures.length) { alert.appendChild( - createDom('span', {className: "menu bar spec-list"}, - createDom("span", {}, "Spec List | "), - createDom('a', {className: "failures-menu", href: "#"}, "Failures"))); + createDom('span', {className: 'menu bar spec-list'}, + createDom('span', {}, 'Spec List | '), + createDom('a', {className: 'failures-menu', href: '#'}, 'Failures'))); alert.appendChild( - createDom('span', {className: "menu bar failure-list"}, - createDom('a', {className: "spec-list-menu", href: "#"}, "Spec List"), - createDom("span", {}, " | Failures "))); + createDom('span', {className: 'menu bar failure-list'}, + createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'), + createDom('span', {}, ' | Failures '))); - find(".failures-menu").onclick = function() { + find('.failures-menu').onclick = function() { setMenuModeTo('failure-list'); }; - find(".spec-list-menu").onclick = function() { + find('.spec-list-menu').onclick = function() { setMenuModeTo('spec-list'); }; setMenuModeTo('failure-list'); - var failureNode = find(".failures"); + var failureNode = find('.failures'); for (var i = 0; i < failures.length; i++) { failureNode.appendChild(failures[i]); } @@ -230,7 +247,16 @@ jasmineRequire.HtmlReporter = function(j$) { return this; function find(selector) { - return getContainer().querySelector(selector); + return getContainer().querySelector('.jasmine_html-reporter ' + selector); + } + + function clearPrior() { + // return the reporter + var oldReporter = find(''); + + if(oldReporter) { + getContainer().removeChild(oldReporter); + } } function createDom(type, attrs, childrenVarArgs) { @@ -249,7 +275,7 @@ jasmineRequire.HtmlReporter = function(j$) { } for (var attr in attrs) { - if (attr == "className") { + if (attr == 'className') { el[attr] = attrs[attr]; } else { el.setAttribute(attr, attrs[attr]); @@ -260,17 +286,22 @@ jasmineRequire.HtmlReporter = function(j$) { } function pluralize(singular, count) { - var word = (count == 1 ? singular : singular + "s"); + var word = (count == 1 ? singular : singular + 's'); - return "" + count + " " + word; + return '' + count + ' ' + word; } function specHref(result) { - return "?spec=" + encodeURIComponent(result.fullName); + return '?spec=' + encodeURIComponent(result.fullName); } function setMenuModeTo(mode) { - htmlReporterMain.setAttribute("class", "html-reporter " + mode); + htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode); + } + + function noExpectations(result) { + return (result.failedExpectations.length + result.passedExpectations.length) === 0 && + result.status === 'passed'; } } @@ -279,7 +310,7 @@ jasmineRequire.HtmlReporter = function(j$) { jasmineRequire.HtmlSpecFilter = function() { function HtmlSpecFilter(options) { - var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); var filterPattern = new RegExp(filterString); this.matches = function(specName) { @@ -328,9 +359,9 @@ jasmineRequire.QueryString = function() { function toQueryString(paramMap) { var qStrPairs = []; for (var prop in paramMap) { - qStrPairs.push(encodeURIComponent(prop) + "=" + encodeURIComponent(paramMap[prop])); + qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])); } - return "?" + qStrPairs.join('&'); + return '?' + qStrPairs.join('&'); } function queryStringToParamMap() { @@ -343,7 +374,7 @@ jasmineRequire.QueryString = function() { for (var i = 0; i < params.length; i++) { var p = params[i].split('='); var value = decodeURIComponent(p[1]); - if (value === "true" || value === "false") { + if (value === 'true' || value === 'false') { value = JSON.parse(value); } paramMap[decodeURIComponent(p[0])] = value; diff --git a/src/test/javascript/lib/jasmine-2.0.1/jasmine.css b/src/test/javascript/lib/jasmine-2.0.1/jasmine.css new file mode 100644 index 0000000..c54ff30 --- /dev/null +++ b/src/test/javascript/lib/jasmine-2.0.1/jasmine.css @@ -0,0 +1,59 @@ +body { overflow-y: scroll; } + +.jasmine_html-reporter { background-color: #eeeeee; padding: 5px; margin: -8px; font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } +.jasmine_html-reporter a { text-decoration: none; } +.jasmine_html-reporter a:hover { text-decoration: underline; } +.jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; } +.jasmine_html-reporter .banner, .jasmine_html-reporter .symbol-summary, .jasmine_html-reporter .summary, .jasmine_html-reporter .result-message, .jasmine_html-reporter .spec .description, .jasmine_html-reporter .spec-detail .description, .jasmine_html-reporter .alert .bar, .jasmine_html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; } +.jasmine_html-reporter .banner { position: relative; } +.jasmine_html-reporter .banner .title { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAZCAMAAACGusnyAAACdlBMVEX/////AP+AgICqVaqAQICZM5mAVYCSSZKAQICOOY6ATYCLRouAQICJO4mSSYCIRIiPQICHPIeOR4CGQ4aMQICGPYaLRoCFQ4WKQICPPYWJRYCOQoSJQICNPoSIRICMQoSHQICHRICKQoOHQICKPoOJO4OJQYOMQICMQ4CIQYKLQICIPoKLQ4CKQICNPoKJQISMQ4KJQoSLQYKJQISLQ4KIQoSKQYKIQICIQISMQoSKQYKLQIOLQoOJQYGLQIOKQIOMQoGKQYOLQYGKQIOLQoGJQYOJQIOKQYGJQIOKQoGKQIGLQIKLQ4KKQoGLQYKJQIGKQYKJQIGKQIKJQoGKQYKLQIGKQYKLQIOJQoKKQ [...] +.jasmine_html-reporter .banner .version { margin-left: 14px; position: relative; top: 6px; } +.jasmine_html-reporter .banner .duration { position: absolute; right: 14px; top: 6px; } +.jasmine_html-reporter #jasmine_content { position: fixed; right: 100%; } +.jasmine_html-reporter .version { color: #aaaaaa; } +.jasmine_html-reporter .banner { margin-top: 14px; } +.jasmine_html-reporter .duration { color: #aaaaaa; float: right; } +.jasmine_html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; } +.jasmine_html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; } +.jasmine_html-reporter .symbol-summary li.passed { font-size: 14px; } +.jasmine_html-reporter .symbol-summary li.passed:before { color: #007069; content: "\02022"; } +.jasmine_html-reporter .symbol-summary li.failed { line-height: 9px; } +.jasmine_html-reporter .symbol-summary li.failed:before { color: #ca3a11; content: "\d7"; font-weight: bold; margin-left: -1px; } +.jasmine_html-reporter .symbol-summary li.disabled { font-size: 14px; } +.jasmine_html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; } +.jasmine_html-reporter .symbol-summary li.pending { line-height: 17px; } +.jasmine_html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; } +.jasmine_html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; } +.jasmine_html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } +.jasmine_html-reporter .bar.failed { background-color: #ca3a11; } +.jasmine_html-reporter .bar.passed { background-color: #007069; } +.jasmine_html-reporter .bar.skipped { background-color: #bababa; } +.jasmine_html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; } +.jasmine_html-reporter .bar.menu a { color: #333333; } +.jasmine_html-reporter .bar a { color: white; } +.jasmine_html-reporter.spec-list .bar.menu.failure-list, .jasmine_html-reporter.spec-list .results .failures { display: none; } +.jasmine_html-reporter.failure-list .bar.menu.spec-list, .jasmine_html-reporter.failure-list .summary { display: none; } +.jasmine_html-reporter .running-alert { background-color: #666666; } +.jasmine_html-reporter .results { margin-top: 14px; } +.jasmine_html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } +.jasmine_html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } +.jasmine_html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } +.jasmine_html-reporter.showDetails .summary { display: none; } +.jasmine_html-reporter.showDetails #details { display: block; } +.jasmine_html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } +.jasmine_html-reporter .summary { margin-top: 14px; } +.jasmine_html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; } +.jasmine_html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; } +.jasmine_html-reporter .summary li.passed a { color: #007069; } +.jasmine_html-reporter .summary li.failed a { color: #ca3a11; } +.jasmine_html-reporter .summary li.empty a { color: #ba9d37; } +.jasmine_html-reporter .summary li.pending a { color: #ba9d37; } +.jasmine_html-reporter .description + .suite { margin-top: 0; } +.jasmine_html-reporter .suite { margin-top: 14px; } +.jasmine_html-reporter .suite a { color: #333333; } +.jasmine_html-reporter .failures .spec-detail { margin-bottom: 28px; } +.jasmine_html-reporter .failures .spec-detail .description { background-color: #ca3a11; } +.jasmine_html-reporter .failures .spec-detail .description a { color: white; } +.jasmine_html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; } +.jasmine_html-reporter .result-message span.result { display: block; } +.jasmine_html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } diff --git a/src/test/javascript/lib/jasmine-2.0.0/jasmine.js b/src/test/javascript/lib/jasmine-2.0.1/jasmine.js similarity index 77% rename from src/test/javascript/lib/jasmine-2.0.0/jasmine.js rename to src/test/javascript/lib/jasmine-2.0.1/jasmine.js index 24463ec..c943db1 100644 --- a/src/test/javascript/lib/jasmine-2.0.0/jasmine.js +++ b/src/test/javascript/lib/jasmine-2.0.1/jasmine.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2013 Pivotal Labs +Copyright (c) 2008-2014 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ function getJasmineRequireObj() { - if (typeof module !== "undefined" && module.exports) { + if (typeof module !== 'undefined' && module.exports) { return exports; } else { window.jasmineRequire = window.jasmineRequire || {}; @@ -36,6 +36,7 @@ getJasmineRequireObj().core = function(jRequire) { j$.util = jRequire.util(); j$.Any = jRequire.Any(); j$.CallTracker = jRequire.CallTracker(); + j$.MockDate = jRequire.MockDate(); j$.Clock = jRequire.Clock(); j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(); j$.Env = jRequire.Env(j$); @@ -46,7 +47,7 @@ getJasmineRequireObj().core = function(jRequire) { j$.matchersUtil = jRequire.matchersUtil(j$); j$.ObjectContaining = jRequire.ObjectContaining(j$); j$.pp = jRequire.pp(j$); - j$.QueueRunner = jRequire.QueueRunner(); + j$.QueueRunner = jRequire.QueueRunner(j$); j$.ReportDispatcher = jRequire.ReportDispatcher(); j$.Spec = jRequire.Spec(j$); j$.SpyStrategy = jRequire.SpyStrategy(); @@ -61,23 +62,23 @@ getJasmineRequireObj().core = function(jRequire) { getJasmineRequireObj().requireMatchers = function(jRequire, j$) { var availableMatchers = [ - "toBe", - "toBeCloseTo", - "toBeDefined", - "toBeFalsy", - "toBeGreaterThan", - "toBeLessThan", - "toBeNaN", - "toBeNull", - "toBeTruthy", - "toBeUndefined", - "toContain", - "toEqual", - "toHaveBeenCalled", - "toHaveBeenCalledWith", - "toMatch", - "toThrow", - "toThrowError" + 'toBe', + 'toBeCloseTo', + 'toBeDefined', + 'toBeFalsy', + 'toBeGreaterThan', + 'toBeLessThan', + 'toBeNaN', + 'toBeNull', + 'toBeTruthy', + 'toBeUndefined', + 'toContain', + 'toEqual', + 'toHaveBeenCalled', + 'toHaveBeenCalledWith', + 'toMatch', + 'toThrow', + 'toThrowError' ], matchers = {}; @@ -89,104 +90,108 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) { return matchers; }; -getJasmineRequireObj().base = function(j$) { - j$.unimplementedMethod_ = function() { - throw new Error("unimplemented method"); - }; +getJasmineRequireObj().base = (function (jasmineGlobal) { + if (typeof module !== 'undefined' && module.exports) { + jasmineGlobal = global; + } - j$.MAX_PRETTY_PRINT_DEPTH = 40; - j$.DEFAULT_TIMEOUT_INTERVAL = 5000; + return function(j$) { + j$.unimplementedMethod_ = function() { + throw new Error('unimplemented method'); + }; - j$.getGlobal = (function() { - var jasmineGlobal = eval.call(null, "this"); - return function() { + j$.MAX_PRETTY_PRINT_DEPTH = 40; + j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100; + j$.DEFAULT_TIMEOUT_INTERVAL = 5000; + + j$.getGlobal = function() { return jasmineGlobal; }; - })(); - j$.getEnv = function(options) { - var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options); - //jasmine. singletons in here (setTimeout blah blah). - return env; - }; + j$.getEnv = function(options) { + var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options); + //jasmine. singletons in here (setTimeout blah blah). + return env; + }; - j$.isArray_ = function(value) { - return j$.isA_("Array", value); - }; + j$.isArray_ = function(value) { + return j$.isA_('Array', value); + }; - j$.isString_ = function(value) { - return j$.isA_("String", value); - }; + j$.isString_ = function(value) { + return j$.isA_('String', value); + }; - j$.isNumber_ = function(value) { - return j$.isA_("Number", value); - }; + j$.isNumber_ = function(value) { + return j$.isA_('Number', value); + }; - j$.isA_ = function(typeName, value) { - return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; - }; + j$.isA_ = function(typeName, value) { + return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; + }; - j$.isDomNode = function(obj) { - return obj.nodeType > 0; - }; + j$.isDomNode = function(obj) { + return obj.nodeType > 0; + }; - j$.any = function(clazz) { - return new j$.Any(clazz); - }; + j$.any = function(clazz) { + return new j$.Any(clazz); + }; - j$.objectContaining = function(sample) { - return new j$.ObjectContaining(sample); - }; + j$.objectContaining = function(sample) { + return new j$.ObjectContaining(sample); + }; - j$.createSpy = function(name, originalFn) { - - var spyStrategy = new j$.SpyStrategy({ - name: name, - fn: originalFn, - getSpy: function() { return spy; } - }), - callTracker = new j$.CallTracker(), - spy = function() { - callTracker.track({ - object: this, - args: Array.prototype.slice.apply(arguments) - }); - return spyStrategy.exec.apply(this, arguments); - }; + j$.createSpy = function(name, originalFn) { - for (var prop in originalFn) { - if (prop === 'and' || prop === 'calls') { - throw new Error("Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon"); - } + var spyStrategy = new j$.SpyStrategy({ + name: name, + fn: originalFn, + getSpy: function() { return spy; } + }), + callTracker = new j$.CallTracker(), + spy = function() { + callTracker.track({ + object: this, + args: Array.prototype.slice.apply(arguments) + }); + return spyStrategy.exec.apply(this, arguments); + }; - spy[prop] = originalFn[prop]; - } + for (var prop in originalFn) { + if (prop === 'and' || prop === 'calls') { + throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon'); + } - spy.and = spyStrategy; - spy.calls = callTracker; + spy[prop] = originalFn[prop]; + } - return spy; - }; + spy.and = spyStrategy; + spy.calls = callTracker; - j$.isSpy = function(putativeSpy) { - if (!putativeSpy) { - return false; - } - return putativeSpy.and instanceof j$.SpyStrategy && - putativeSpy.calls instanceof j$.CallTracker; - }; + return spy; + }; - j$.createSpyObj = function(baseName, methodNames) { - if (!j$.isArray_(methodNames) || methodNames.length === 0) { - throw "createSpyObj requires a non-empty array of method names to create spies for"; - } - var obj = {}; - for (var i = 0; i < methodNames.length; i++) { - obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]); - } - return obj; + j$.isSpy = function(putativeSpy) { + if (!putativeSpy) { + return false; + } + return putativeSpy.and instanceof j$.SpyStrategy && + putativeSpy.calls instanceof j$.CallTracker; + }; + + j$.createSpyObj = function(baseName, methodNames) { + if (!j$.isArray_(methodNames) || methodNames.length === 0) { + throw 'createSpyObj requires a non-empty array of method names to create spies for'; + } + var obj = {}; + for (var i = 0; i < methodNames.length; i++) { + obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]); + } + return obj; + }; }; -}; +})(this); getJasmineRequireObj().util = function() { @@ -220,6 +225,16 @@ getJasmineRequireObj().util = function() { return obj === void 0; }; + util.arrayContains = function(array, search) { + var i = array.length; + while (i--) { + if (array[i] == search) { + return true; + } + } + return false; + }; + return util; }; @@ -239,8 +254,6 @@ getJasmineRequireObj().Spec = function(j$) { this.queueRunnerFactory = attrs.queueRunnerFactory || function() {}; this.catchingExceptions = attrs.catchingExceptions || function() { return true; }; - this.timer = attrs.timer || {setTimeout: setTimeout, clearTimeout: clearTimeout}; - if (!this.fn) { this.pend(); } @@ -249,15 +262,18 @@ getJasmineRequireObj().Spec = function(j$) { id: this.id, description: this.description, fullName: this.getFullName(), - failedExpectations: [] + failedExpectations: [], + passedExpectations: [] }; } Spec.prototype.addExpectationResult = function(passed, data) { + var expectationResult = this.expectationResultFactory(data); if (passed) { - return; + this.result.passedExpectations.push(expectationResult); + } else { + this.result.failedExpectations.push(expectationResult); } - this.result.failedExpectations.push(this.expectationResultFactory(data)); }; Spec.prototype.expect = function(actual) { @@ -265,8 +281,7 @@ getJasmineRequireObj().Spec = function(j$) { }; Spec.prototype.execute = function(onComplete) { - var self = this, - timeout; + var self = this; this.onStart(this); @@ -275,52 +290,26 @@ getJasmineRequireObj().Spec = function(j$) { return; } - function timeoutable(fn) { - return function(done) { - timeout = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() { - onException(new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.')); - done(); - }, j$.DEFAULT_TIMEOUT_INTERVAL]]); - - var callDone = function() { - clearTimeoutable(); - done(); - }; - - fn.call(this, callDone); //TODO: do we care about more than 1 arg? - }; - } - - function clearTimeoutable() { - Function.prototype.apply.apply(self.timer.clearTimeout, [j$.getGlobal(), [timeout]]); - timeout = void 0; - } - - var allFns = this.beforeFns().concat(this.fn).concat(this.afterFns()), - allTimeoutableFns = []; - for (var i = 0; i < allFns.length; i++) { - var fn = allFns[i]; - allTimeoutableFns.push(fn.length > 0 ? timeoutable(fn) : fn); - } + var allFns = this.beforeFns().concat(this.fn).concat(this.afterFns()); this.queueRunnerFactory({ - fns: allTimeoutableFns, + fns: allFns, onException: onException, - onComplete: complete + onComplete: complete, + enforceTimeout: function() { return true; } }); function onException(e) { - clearTimeoutable(); if (Spec.isPendingSpecException(e)) { self.pend(); return; } self.addExpectationResult(false, { - matcherName: "", + matcherName: '', passed: false, - expected: "", - actual: "", + expected: '', + actual: '', error: e }); } @@ -363,16 +352,16 @@ getJasmineRequireObj().Spec = function(j$) { return this.getSpecName(this); }; - Spec.pendingSpecExceptionMessage = "=> marked Pending"; + Spec.pendingSpecExceptionMessage = '=> marked Pending'; Spec.isPendingSpecException = function(e) { - return e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1; + return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1); }; return Spec; }; -if (typeof window == void 0 && typeof exports == "object") { +if (typeof window == void 0 && typeof exports == 'object') { exports.Spec = jasmineRequire.Spec; } @@ -389,7 +378,7 @@ getJasmineRequireObj().Env = function(j$) { var realSetTimeout = j$.getGlobal().setTimeout; var realClearTimeout = j$.getGlobal().clearTimeout; - this.clock = new j$.Clock(global, new j$.DelayedFunctionScheduler()); + this.clock = new j$.Clock(global, new j$.DelayedFunctionScheduler(), new j$.MockDate(global)); var runnableLookupTable = {}; @@ -399,12 +388,12 @@ getJasmineRequireObj().Env = function(j$) { var currentSuite = null; var reporter = new j$.ReportDispatcher([ - "jasmineStarted", - "jasmineDone", - "suiteStarted", - "suiteDone", - "specStarted", - "specDone" + 'jasmineStarted', + 'jasmineDone', + 'suiteStarted', + 'suiteDone', + 'specStarted', + 'specDone' ]); this.specFilter = function() { @@ -514,6 +503,7 @@ getJasmineRequireObj().Env = function(j$) { var queueRunnerFactory = function(options) { options.catchException = catchException; options.clearStack = options.clearStack || clearStack; + options.timer = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout}; new j$.QueueRunner(options).execute(); }; @@ -558,7 +548,7 @@ getJasmineRequireObj().Env = function(j$) { this.spyOn = function(obj, methodName) { if (j$.util.isUndefined(obj)) { - throw new Error("spyOn could not find an object to spy upon for " + methodName + "()"); + throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()'); } if (j$.util.isUndefined(obj[methodName])) { @@ -616,7 +606,7 @@ getJasmineRequireObj().Env = function(j$) { } if (declarationError) { - this.it("encountered a declaration exception", function() { + this.it('encountered a declaration exception', function() { throw declarationError; }); } @@ -649,8 +639,7 @@ getJasmineRequireObj().Env = function(j$) { description: description, expectationResultFactory: expectationResultFactory, queueRunnerFactory: queueRunnerFactory, - fn: fn, - timer: {setTimeout: realSetTimeout, clearTimeout: realClearTimeout} + fn: fn }); runnableLookupTable[spec.id] = spec; @@ -695,6 +684,10 @@ getJasmineRequireObj().Env = function(j$) { }; this.expect = function(actual) { + if (!currentSpec) { + throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out'); + } + return currentSpec.expect(actual); }; @@ -723,7 +716,7 @@ getJasmineRequireObj().JsApiReporter = function() { function JsApiReporter(options) { var timer = options.timer || noopTimer, - status = "loaded"; + status = 'loaded'; this.started = false; this.finished = false; @@ -819,7 +812,7 @@ getJasmineRequireObj().Any = function() { }; Any.prototype.jasmineToString = function() { - return '<jasmine.any(' + this.expectedClass + ')>'; + return '<jasmine.any(' + this.expectedObject + ')>'; }; return Any; @@ -877,7 +870,7 @@ getJasmineRequireObj().CallTracker = function() { }; getJasmineRequireObj().Clock = function() { - function Clock(global, delayedFunctionScheduler) { + function Clock(global, delayedFunctionScheduler, mockDate) { var self = this, realTimingFunctions = { setTimeout: global.setTimeout, @@ -894,23 +887,32 @@ getJasmineRequireObj().Clock = function() { installed = false, timer; + self.install = function() { replace(global, fakeTimingFunctions); timer = fakeTimingFunctions; installed = true; + + return self; }; self.uninstall = function() { delayedFunctionScheduler.reset(); + mockDate.uninstall(); replace(global, realTimingFunctions); + timer = realTimingFunctions; installed = false; }; + self.mockDate = function(initialDate) { + mockDate.install(initialDate); + }; + self.setTimeout = function(fn, delay, params) { if (legacyIE()) { if (arguments.length > 2) { - throw new Error("IE < 9 cannot support extra params to setTimeout without a polyfill"); + throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill'); } return timer.setTimeout(fn, delay); } @@ -920,7 +922,7 @@ getJasmineRequireObj().Clock = function() { self.setInterval = function(fn, delay, params) { if (legacyIE()) { if (arguments.length > 2) { - throw new Error("IE < 9 cannot support extra params to setInterval without a polyfill"); + throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill'); } return timer.setInterval(fn, delay); } @@ -937,9 +939,10 @@ getJasmineRequireObj().Clock = function() { self.tick = function(millis) { if (installed) { + mockDate.tick(millis); delayedFunctionScheduler.tick(millis); } else { - throw new Error("Mock clock is not installed, use jasmine.clock().install()"); + throw new Error('Mock clock is not installed, use jasmine.clock().install()'); } }; @@ -973,7 +976,7 @@ getJasmineRequireObj().Clock = function() { } function argSlice(argsObj, n) { - return Array.prototype.slice.call(argsObj, 2); + return Array.prototype.slice.call(argsObj, n); } } @@ -1129,16 +1132,20 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() { getJasmineRequireObj().ExceptionFormatter = function() { function ExceptionFormatter() { this.message = function(error) { - var message = error.name + - ': ' + - error.message; + var message = ''; + + if (error.name && error.message) { + message += error.name + ': ' + error.message; + } else { + message += error.toString() + ' thrown'; + } if (error.fileName || error.sourceURL) { - message += " in " + (error.fileName || error.sourceURL); + message += ' in ' + (error.fileName || error.sourceURL); } if (error.line || error.lineNumber) { - message += " (line " + (error.line || error.lineNumber) + ")"; + message += ' (line ' + (error.line || error.lineNumber) + ')'; } return message; @@ -1172,7 +1179,7 @@ getJasmineRequireObj().Expectation = function() { return function() { var args = Array.prototype.slice.call(arguments, 0), expected = args.slice(0), - message = ""; + message = ''; args.unshift(this.actual); @@ -1197,7 +1204,11 @@ getJasmineRequireObj().Expectation = function() { args.unshift(name); message = this.util.buildFailureMessage.apply(null, args); } else { - message = result.message; + if (Object.prototype.toString.apply(result.message) === '[object Function]') { + message = result.message(); + } else { + message = result.message; + } } } @@ -1273,18 +1284,18 @@ getJasmineRequireObj().buildExpectationResult = function() { function message() { if (options.passed) { - return "Passed."; + return 'Passed.'; } else if (options.message) { return options.message; } else if (options.error) { return messageFormatter(options.error); } - return ""; + return ''; } function stack() { if (options.passed) { - return ""; + return ''; } var error = options.error; @@ -1302,6 +1313,73 @@ getJasmineRequireObj().buildExpectationResult = function() { return buildExpectationResult; }; +getJasmineRequireObj().MockDate = function() { + function MockDate(global) { + var self = this; + var currentTime = 0; + + if (!global || !global.Date) { + self.install = function() {}; + self.tick = function() {}; + self.uninstall = function() {}; + return self; + } + + var GlobalDate = global.Date; + + self.install = function(mockDate) { + if (mockDate instanceof GlobalDate) { + currentTime = mockDate.getTime(); + } else { + currentTime = new GlobalDate().getTime(); + } + + global.Date = FakeDate; + }; + + self.tick = function(millis) { + millis = millis || 0; + currentTime = currentTime + millis; + }; + + self.uninstall = function() { + currentTime = 0; + global.Date = GlobalDate; + }; + + createDateProperties(); + + return self; + + function FakeDate() { + if (arguments.length === 0) { + return new GlobalDate(currentTime); + } else { + return new GlobalDate(arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4], arguments[5], arguments[6]); + } + } + + function createDateProperties() { + + FakeDate.now = function() { + if (GlobalDate.now) { + return currentTime; + } else { + throw new Error('Browser does not support Date.now()'); + } + }; + + FakeDate.toSource = GlobalDate.toSource; + FakeDate.toString = GlobalDate.toString; + FakeDate.parse = GlobalDate.parse; + FakeDate.UTC = GlobalDate.UTC; + } + } + + return MockDate; +}; + getJasmineRequireObj().ObjectContaining = function(j$) { function ObjectContaining(sample) { @@ -1309,7 +1387,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) { } ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) { - if (typeof(this.sample) !== "object") { throw new Error("You must provide an object to objectContaining, not '"+this.sample+"'."); } + if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); } mismatchKeys = mismatchKeys || []; mismatchValues = mismatchValues || []; @@ -1320,10 +1398,10 @@ getJasmineRequireObj().ObjectContaining = function(j$) { for (var property in this.sample) { if (!hasKey(other, property) && hasKey(this.sample, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); + mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.'); } - else if (!j$.matchersUtil.equals(this.sample[property], other[property])) { - mismatchValues.push("'" + property + "' was '" + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + "' in actual, but was '" + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in expected."); + else if (!j$.matchersUtil.equals(other[property], this.sample[property])) { + mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + '\' in actual, but was \'' + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in expected.'); } } @@ -1331,7 +1409,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) { }; ObjectContaining.prototype.jasmineToString = function() { - return "<jasmine.objectContaining(" + j$.pp(this.sample) + ")>"; + return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>'; }; return ObjectContaining; @@ -1341,6 +1419,7 @@ getJasmineRequireObj().pp = function(j$) { function PrettyPrinter() { this.ppNestLevel_ = 0; + this.seen = []; } PrettyPrinter.prototype.format = function(value) { @@ -1350,6 +1429,8 @@ getJasmineRequireObj().pp = function(j$) { this.emitScalar('undefined'); } else if (value === null) { this.emitScalar('null'); + } else if (value === 0 && 1/value === -Infinity) { + this.emitScalar('-0'); } else if (value === j$.getGlobal()) { this.emitScalar('<global>'); } else if (value.jasmineToString) { @@ -1357,7 +1438,7 @@ getJasmineRequireObj().pp = function(j$) { } else if (typeof value === 'string') { this.emitString(value); } else if (j$.isSpy(value)) { - this.emitScalar("spy on " + value.and.identity()); + this.emitScalar('spy on ' + value.and.identity()); } else if (value instanceof RegExp) { this.emitScalar(value.toString()); } else if (typeof value === 'function') { @@ -1366,16 +1447,16 @@ getJasmineRequireObj().pp = function(j$) { this.emitScalar('HTMLNode'); } else if (value instanceof Date) { this.emitScalar('Date(' + value + ')'); - } else if (value.__Jasmine_been_here_before__) { + } else if (j$.util.arrayContains(this.seen, value)) { this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>'); } else if (j$.isArray_(value) || j$.isA_('Object', value)) { - value.__Jasmine_been_here_before__ = true; + this.seen.push(value); if (j$.isArray_(value)) { this.emitArray(value); } else { this.emitObject(value); } - delete value.__Jasmine_been_here_before__; + this.seen.pop(); } else { this.emitScalar(value.toString()); } @@ -1386,8 +1467,7 @@ getJasmineRequireObj().pp = function(j$) { PrettyPrinter.prototype.iterateObject = function(obj, fn) { for (var property in obj) { - if (!obj.hasOwnProperty(property)) { continue; } - if (property == '__Jasmine_been_here_before__') { continue; } + if (!Object.prototype.hasOwnProperty.call(obj, property)) { continue; } fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) && obj.__lookupGetter__(property) !== null) : false); } @@ -1411,28 +1491,31 @@ getJasmineRequireObj().pp = function(j$) { }; StringPrettyPrinter.prototype.emitString = function(value) { - this.append("'" + value + "'"); + this.append('\'' + value + '\''); }; StringPrettyPrinter.prototype.emitArray = function(array) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append("Array"); + this.append('Array'); return; } - + var length = Math.min(array.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); this.append('[ '); - for (var i = 0; i < array.length; i++) { + for (var i = 0; i < length; i++) { if (i > 0) { this.append(', '); } this.format(array[i]); } + if(array.length > length){ + this.append(', ...'); + } this.append(' ]'); }; StringPrettyPrinter.prototype.emitObject = function(obj) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append("Object"); + this.append('Object'); return; } @@ -1448,7 +1531,7 @@ getJasmineRequireObj().pp = function(j$) { } self.append(property); - self.append(' : '); + self.append(': '); if (isGetter) { self.append('<getter>'); } else { @@ -1470,7 +1553,17 @@ getJasmineRequireObj().pp = function(j$) { }; }; -getJasmineRequireObj().QueueRunner = function() { +getJasmineRequireObj().QueueRunner = function(j$) { + + function once(fn) { + var called = false; + return function() { + if (!called) { + called = true; + fn(); + } + }; + } function QueueRunner(attrs) { this.fns = attrs.fns || []; @@ -1478,7 +1571,9 @@ getJasmineRequireObj().QueueRunner = function() { this.clearStack = attrs.clearStack || function(fn) {fn();}; this.onException = attrs.onException || function() {}; this.catchException = attrs.catchException || function() { return true; }; + this.enforceTimeout = attrs.enforceTimeout || function() { return false; }; this.userContext = {}; + this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; } QueueRunner.prototype.execute = function() { @@ -1514,7 +1609,21 @@ getJasmineRequireObj().QueueRunner = function() { } function attemptAsync(fn) { - var next = function () { self.run(fns, iterativeIndex + 1); }; + var clearTimeout = function () { + Function.prototype.apply.apply(self.timer.clearTimeout, [j$.getGlobal(), [timeoutId]]); + }, + next = once(function () { + clearTimeout(timeoutId); + self.run(fns, iterativeIndex + 1); + }), + timeoutId; + + if (self.enforceTimeout()) { + timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() { + self.onException(new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.')); + next(); + }, j$.DEFAULT_TIMEOUT_INTERVAL]]); + } try { fn.call(self.userContext, next); @@ -1578,7 +1687,7 @@ getJasmineRequireObj().SpyStrategy = function() { function SpyStrategy(options) { options = options || {}; - var identity = options.name || "unknown", + var identity = options.name || 'unknown', originalFn = options.fn || function() {}, getSpy = options.getSpy || function() {}, plan = function() {}; @@ -1712,16 +1821,20 @@ getJasmineRequireObj().Suite = function() { return Suite; }; -if (typeof window == void 0 && typeof exports == "object") { +if (typeof window == void 0 && typeof exports == 'object') { exports.Suite = jasmineRequire.Suite; } getJasmineRequireObj().Timer = function() { + var defaultNow = (function(Date) { + return function() { return new Date().getTime(); }; + })(Date); + function Timer(options) { options = options || {}; - var now = options.now || function() { return new Date().getTime(); }, - startTime; + var now = options.now || defaultNow, + startTime; this.start = function() { startTime = now(); @@ -1748,7 +1861,7 @@ getJasmineRequireObj().matchersUtil = function(j$) { contains: function(haystack, needle, customTesters) { customTesters = customTesters || []; - if (Object.prototype.toString.apply(haystack) === "[object Array]") { + if (Object.prototype.toString.apply(haystack) === '[object Array]') { for (var i = 0; i < haystack.length; i++) { if (eq(haystack[i], needle, [], [], customTesters)) { return true; @@ -1756,7 +1869,7 @@ getJasmineRequireObj().matchersUtil = function(j$) { } return false; } - return haystack.indexOf(needle) >= 0; + return !!haystack && haystack.indexOf(needle) >= 0; }, buildFailureMessage: function() { @@ -1767,21 +1880,21 @@ getJasmineRequireObj().matchersUtil = function(j$) { expected = args.slice(3), englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); - var message = "Expected " + + var message = 'Expected ' + j$.pp(actual) + - (isNot ? " not " : " ") + + (isNot ? ' not ' : ' ') + englishyPredicate; if (expected.length > 0) { for (var i = 0; i < expected.length; i++) { if (i > 0) { - message += ","; + message += ','; } - message += " " + j$.pp(expected[i]); + message += ' ' + j$.pp(expected[i]); } } - return message + "."; + return message + '.'; } }; @@ -2018,9 +2131,9 @@ getJasmineRequireObj().toBeNaN = function(j$) { }; if (result.pass) { - result.message = "Expected actual not to be NaN."; + result.message = 'Expected actual not to be NaN.'; } else { - result.message = "Expected " + j$.pp(actual) + " to be NaN."; + result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; }; } return result; @@ -2132,8 +2245,8 @@ getJasmineRequireObj().toHaveBeenCalled = function(j$) { result.pass = actual.calls.any(); result.message = result.pass ? - "Expected spy " + actual.and.identity() + " not to have been called." : - "Expected spy " + actual.and.identity() + " to have been called."; + 'Expected spy ' + actual.and.identity() + ' not to have been called.' : + 'Expected spy ' + actual.and.identity() + ' to have been called.'; return result; } @@ -2145,7 +2258,7 @@ getJasmineRequireObj().toHaveBeenCalled = function(j$) { getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { - function toHaveBeenCalledWith(util) { + function toHaveBeenCalledWith(util, customEqualityTesters) { return { compare: function() { var args = Array.prototype.slice.call(arguments, 0), @@ -2158,15 +2271,15 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { } if (!actual.calls.any()) { - result.message = "Expected spy " + actual.and.identity() + " to have been called with " + j$.pp(expectedArgs) + " but it was never called."; + result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but it was never called.'; }; return result; } - if (util.contains(actual.calls.allArgs(), expectedArgs)) { + if (util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) { result.pass = true; - result.message = "Expected spy " + actual.and.identity() + " not to have been called with " + j$.pp(expectedArgs) + " but it was."; + result.message = function() { return 'Expected spy ' + actual.and.identity() + ' not to have been called with ' + j$.pp(expectedArgs) + ' but it was.'; }; } else { - result.message = "Expected spy " + actual.and.identity() + " to have been called with " + j$.pp(expectedArgs) + " but actual calls were " + j$.pp(actual.calls.allArgs()).replace(/^\[ | \]$/g, '') + "."; + result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but actual calls were ' + j$.pp(actual.calls.allArgs()).replace(/^\[ | \]$/g, '') + '.'; }; } return result; @@ -2203,8 +2316,8 @@ getJasmineRequireObj().toThrow = function(j$) { threw = false, thrown; - if (typeof actual != "function") { - throw new Error("Actual is not a Function"); + if (typeof actual != 'function') { + throw new Error('Actual is not a Function'); } try { @@ -2215,22 +2328,22 @@ getJasmineRequireObj().toThrow = function(j$) { } if (!threw) { - result.message = "Expected function to throw an exception."; + result.message = 'Expected function to throw an exception.'; return result; } if (arguments.length == 1) { result.pass = true; - result.message = "Expected function not to throw, but it threw " + j$.pp(thrown) + "."; + result.message = function() { return 'Expected function not to throw, but it threw ' + j$.pp(thrown) + '.'; }; return result; } if (util.equals(thrown, expected)) { result.pass = true; - result.message = "Expected function not to throw " + j$.pp(expected) + "."; + result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; }; } else { - result.message = "Expected function to throw " + j$.pp(expected) + ", but it threw " + j$.pp(thrown) + "."; + result.message = function() { return 'Expected function to throw ' + j$.pp(expected) + ', but it threw ' + j$.pp(thrown) + '.'; }; } return result; @@ -2246,6 +2359,8 @@ getJasmineRequireObj().toThrowError = function(j$) { return { compare: function(actual) { var threw = false, + pass = {pass: true}, + fail = {pass: false}, thrown, errorType, message, @@ -2253,8 +2368,8 @@ getJasmineRequireObj().toThrowError = function(j$) { name, constructorName; - if (typeof actual != "function") { - throw new Error("Actual is not a Function"); + if (typeof actual != 'function') { + throw new Error('Actual is not a Function'); } extractExpectedParams.apply(null, arguments); @@ -2267,15 +2382,18 @@ getJasmineRequireObj().toThrowError = function(j$) { } if (!threw) { - return fail("Expected function to throw an Error."); + fail.message = 'Expected function to throw an Error.'; + return fail; } if (!(thrown instanceof Error)) { - return fail("Expected function to throw an Error, but it threw " + thrown + "."); + fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; }; + return fail; } if (arguments.length == 1) { - return pass("Expected function not to throw an Error, but it threw " + fnNameFor(thrown) + "."); + pass.message = 'Expected function not to throw an Error, but it threw ' + fnNameFor(thrown) + '.'; + return pass; } if (errorType) { @@ -2285,45 +2403,55 @@ getJasmineRequireObj().toThrowError = function(j$) { if (errorType && message) { if (thrown.constructor == errorType && util.equals(thrown.message, message)) { - return pass("Expected function not to throw " + name + " with message \"" + message + "\"."); + pass.message = function() { return 'Expected function not to throw ' + name + ' with message ' + j$.pp(message) + '.'; }; + return pass; } else { - return fail("Expected function to throw " + name + " with message \"" + message + - "\", but it threw " + constructorName + " with message \"" + thrown.message + "\"."); + fail.message = function() { return 'Expected function to throw ' + name + ' with message ' + j$.pp(message) + + ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; }; + return fail; } } if (errorType && regexp) { if (thrown.constructor == errorType && regexp.test(thrown.message)) { - return pass("Expected function not to throw " + name + " with message matching " + regexp + "."); + pass.message = function() { return 'Expected function not to throw ' + name + ' with message matching ' + j$.pp(regexp) + '.'; }; + return pass; } else { - return fail("Expected function to throw " + name + " with message matching " + regexp + - ", but it threw " + constructorName + " with message \"" + thrown.message + "\"."); + fail.message = function() { return 'Expected function to throw ' + name + ' with message matching ' + j$.pp(regexp) + + ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; }; + return fail; } } if (errorType) { if (thrown.constructor == errorType) { - return pass("Expected function not to throw " + name + "."); + pass.message = 'Expected function not to throw ' + name + '.'; + return pass; } else { - return fail("Expected function to throw " + name + ", but it threw " + constructorName + "."); + fail.message = 'Expected function to throw ' + name + ', but it threw ' + constructorName + '.'; + return fail; } } if (message) { if (thrown.message == message) { - return pass("Expected function not to throw an exception with message " + j$.pp(message) + "."); + pass.message = function() { return 'Expected function not to throw an exception with message ' + j$.pp(message) + '.'; }; + return pass; } else { - return fail("Expected function to throw an exception with message " + j$.pp(message) + - ", but it threw an exception with message " + j$.pp(thrown.message) + "."); + fail.message = function() { return 'Expected function to throw an exception with message ' + j$.pp(message) + + ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; }; + return fail; } } if (regexp) { if (regexp.test(thrown.message)) { - return pass("Expected function not to throw an exception with a message matching " + j$.pp(regexp) + "."); + pass.message = function() { return 'Expected function not to throw an exception with a message matching ' + j$.pp(regexp) + '.'; }; + return pass; } else { - return fail("Expected function to throw an exception with a message matching " + j$.pp(regexp) + - ", but it threw an exception with message " + j$.pp(thrown.message) + "."); + fail.message = function() { return 'Expected function to throw an exception with a message matching ' + j$.pp(regexp) + + ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; }; + return fail; } } @@ -2331,20 +2459,6 @@ getJasmineRequireObj().toThrowError = function(j$) { return func.name || func.toString().match(/^\s*function\s*(\w*)\s*\(/)[1]; } - function pass(notMessage) { - return { - pass: true, - message: notMessage - }; - } - - function fail(message) { - return { - pass: false, - message: message - }; - } - function extractExpectedParams() { if (arguments.length == 1) { return; @@ -2355,34 +2469,34 @@ getJasmineRequireObj().toThrowError = function(j$) { if (expected instanceof RegExp) { regexp = expected; - } else if (typeof expected == "string") { + } else if (typeof expected == 'string') { message = expected; } else if (checkForAnErrorType(expected)) { errorType = expected; } if (!(errorType || message || regexp)) { - throw new Error("Expected is not an Error, string, or RegExp."); + throw new Error('Expected is not an Error, string, or RegExp.'); } } else { if (checkForAnErrorType(arguments[1])) { errorType = arguments[1]; } else { - throw new Error("Expected error type is not an Error."); + throw new Error('Expected error type is not an Error.'); } if (arguments[2] instanceof RegExp) { regexp = arguments[2]; - } else if (typeof arguments[2] == "string") { + } else if (typeof arguments[2] == 'string') { message = arguments[2]; } else { - throw new Error("Expected error message is not a string or RegExp."); + throw new Error('Expected error message is not a string or RegExp.'); } } } function checkForAnErrorType(type) { - if (typeof type !== "function") { + if (typeof type !== 'function') { return false; } @@ -2398,5 +2512,5 @@ getJasmineRequireObj().toThrowError = function(j$) { }; getJasmineRequireObj().version = function() { - return "2.0.0"; + return '2.0.1'; }; diff --git a/src/test/javascript/lib/jasmine-2.0.1/jasmine_favicon.png b/src/test/javascript/lib/jasmine-2.0.1/jasmine_favicon.png new file mode 100644 index 0000000..3b84583 Binary files /dev/null and b/src/test/javascript/lib/jasmine-2.0.1/jasmine_favicon.png differ diff --git a/src/test/javascript/spec/suite.html b/src/test/javascript/spec/suite.html index d48c520..9151b94 100644 --- a/src/test/javascript/spec/suite.html +++ b/src/test/javascript/spec/suite.html @@ -2,14 +2,14 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <title>Jasmine Spec Runner v2.0.0</title> + <title>Jasmine Spec Runner v2.0.1</title> - <link rel="shortcut icon" type="image/png" href="../lib/jasmine-2.0.0/jasmine_favicon.png"> - <link rel="stylesheet" type="text/css" href="../lib/jasmine-2.0.0/jasmine.css"> + <link rel="shortcut icon" type="image/png" href="../lib/jasmine-2.0.1/jasmine_favicon.png"> + <link rel="stylesheet" type="text/css" href="../lib/jasmine-2.0.1/jasmine.css"> - <script type="text/javascript" src="../lib/jasmine-2.0.0/jasmine.js"></script> - <script type="text/javascript" src="../lib/jasmine-2.0.0/jasmine-html.js"></script> - <script type="text/javascript" src="../lib/jasmine-2.0.0/boot.js"></script> + <script type="text/javascript" src="../lib/jasmine-2.0.1/jasmine.js"></script> + <script type="text/javascript" src="../lib/jasmine-2.0.1/jasmine-html.js"></script> + <script type="text/javascript" src="../lib/jasmine-2.0.1/boot.js"></script> <!-- include source files here... --> <script type="text/javascript" src="../../../main/resources/jscoverage-common.js"></script> -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jscover.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

