add single quote check to jshint and fix src files for that

[fixes #522]
This commit is contained in:
Robin Böhm
2014-02-16 23:28:20 +01:00
committed by Greg Cobb and Sheel Choksi
parent 095b02ad83
commit 31d71ac22f
30 changed files with 384 additions and 383 deletions

View File

@@ -4,5 +4,6 @@
"immed": true, "immed": true,
"newcap": true, "newcap": true,
"trailing": true, "trailing": true,
"loopfunc": true "loopfunc": true,
"quotmark": "single"
} }

View File

@@ -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. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
function getJasmineRequireObj() { function getJasmineRequireObj() {
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
return exports; return exports;
} else { } else {
window.jasmineRequire = window.jasmineRequire || {}; window.jasmineRequire = window.jasmineRequire || {};
@@ -60,7 +60,7 @@ getJasmineRequireObj().ConsoleReporter = function() {
specCount = 0; specCount = 0;
failureCount = 0; failureCount = 0;
pendingCount = 0; pendingCount = 0;
print("Started"); print('Started');
printNewline(); printNewline();
timer.start(); timer.start();
}; };
@@ -72,18 +72,18 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
printNewline(); printNewline();
var specCounts = specCount + " " + plural("spec", specCount) + ", " + var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' +
failureCount + " " + plural("failure", failureCount); failureCount + ' ' + plural('failure', failureCount);
if (pendingCount) { if (pendingCount) {
specCounts += ", " + pendingCount + " pending " + plural("spec", pendingCount); specCounts += ', ' + pendingCount + ' pending ' + plural('spec', pendingCount);
} }
print(specCounts); print(specCounts);
printNewline(); printNewline();
var seconds = timer.elapsed() / 1000; var seconds = timer.elapsed() / 1000;
print("Finished in " + seconds + " " + plural("second", seconds)); print('Finished in ' + seconds + ' ' + plural('second', seconds));
printNewline(); printNewline();
@@ -93,28 +93,28 @@ getJasmineRequireObj().ConsoleReporter = function() {
this.specDone = function(result) { this.specDone = function(result) {
specCount++; specCount++;
if (result.status == "pending") { if (result.status == 'pending') {
pendingCount++; pendingCount++;
print(colored("yellow", "*")); print(colored('yellow', '*'));
return; return;
} }
if (result.status == "passed") { if (result.status == 'passed') {
print(colored("green", '.')); print(colored('green', '.'));
return; return;
} }
if (result.status == "failed") { if (result.status == 'failed') {
failureCount++; failureCount++;
failedSpecs.push(result); failedSpecs.push(result);
print(colored("red", 'F')); print(colored('red', 'F'));
} }
}; };
return this; return this;
function printNewline() { function printNewline() {
print("\n"); print('\n');
} }
function colored(color, str) { function colored(color, str) {
@@ -122,7 +122,7 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
function plural(str, count) { function plural(str, count) {
return count == 1 ? str : str + "s"; return count == 1 ? str : str + 's';
} }
function repeat(thing, times) { function repeat(thing, times) {
@@ -134,12 +134,12 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
function indent(str, spaces) { function indent(str, spaces) {
var lines = (str || '').split("\n"); var lines = (str || '').split('\n');
var newArr = []; var newArr = [];
for (var i = 0; i < lines.length; i++) { 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) { function specFailureDetails(result) {

View File

@@ -49,20 +49,20 @@ jasmineRequire.HtmlReporter = function(j$) {
symbols; symbols;
this.initialize = function() { this.initialize = function() {
htmlReporterMain = createDom("div", {className: "html-reporter"}, htmlReporterMain = createDom('div', {className: 'html-reporter'},
createDom("div", {className: "banner"}, createDom('div', {className: 'banner'},
createDom("span", {className: "title"}, "Jasmine"), createDom('span', {className: 'title'}, 'Jasmine'),
createDom("span", {className: "version"}, j$.version) createDom('span', {className: 'version'}, j$.version)
), ),
createDom("ul", {className: "symbol-summary"}), createDom('ul', {className: 'symbol-summary'}),
createDom("div", {className: "alert"}), createDom('div', {className: 'alert'}),
createDom("div", {className: "results"}, createDom('div', {className: 'results'},
createDom("div", {className: "failures"}) createDom('div', {className: 'failures'})
) )
); );
getContainer().appendChild(htmlReporterMain); getContainer().appendChild(htmlReporterMain);
symbols = find(".symbol-summary"); symbols = find('.symbol-summary');
}; };
var totalSpecsDefined; var totalSpecsDefined;
@@ -71,13 +71,13 @@ jasmineRequire.HtmlReporter = function(j$) {
timer.start(); 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; currentParent = topResults;
this.suiteStarted = function(result) { this.suiteStarted = function(result) {
currentParent.addChild(result, "suite"); currentParent.addChild(result, 'suite');
currentParent = currentParent.last(); currentParent = currentParent.last();
}; };
@@ -90,82 +90,82 @@ jasmineRequire.HtmlReporter = function(j$) {
}; };
this.specStarted = function(result) { this.specStarted = function(result) {
currentParent.addChild(result, "spec"); currentParent.addChild(result, 'spec');
}; };
var failures = []; var failures = [];
this.specDone = function(result) { this.specDone = function(result) {
if (result.status != "disabled") { if (result.status != 'disabled') {
specsExecuted++; specsExecuted++;
} }
symbols.appendChild(createDom("li", { symbols.appendChild(createDom('li', {
className: result.status, className: result.status,
id: "spec_" + result.id, id: 'spec_' + result.id,
title: result.fullName title: result.fullName
} }
)); ));
if (result.status == "failed") { if (result.status == 'failed') {
failureCount++; failureCount++;
var failure = var failure =
createDom("div", {className: "spec-detail failed"}, createDom('div', {className: 'spec-detail failed'},
createDom("div", {className: "description"}, createDom('div', {className: 'description'},
createDom("a", {title: result.fullName, href: specHref(result)}, result.fullName) createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
), ),
createDom("div", {className: "messages"}) createDom('div', {className: 'messages'})
); );
var messages = failure.childNodes[1]; var messages = failure.childNodes[1];
for (var i = 0; i < result.failedExpectations.length; i++) { for (var i = 0; i < result.failedExpectations.length; i++) {
var expectation = result.failedExpectations[i]; var expectation = result.failedExpectations[i];
messages.appendChild(createDom("div", {className: "result-message"}, expectation.message)); messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
messages.appendChild(createDom("div", {className: "stack-trace"}, expectation.stack)); messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
} }
failures.push(failure); failures.push(failure);
} }
if (result.status == "pending") { if (result.status == 'pending') {
pendingSpecCount++; pendingSpecCount++;
} }
}; };
this.jasmineDone = function() { this.jasmineDone = function() {
var banner = find(".banner"); var banner = find('.banner');
banner.appendChild(createDom("span", {className: "duration"}, "finished in " + timer.elapsed() / 1000 + "s")); 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" }, alert.appendChild(createDom('span', { className: 'exceptions' },
createDom("label", { className: "label", 'for': "raise-exceptions" }, "raise exceptions"), createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'),
createDom("input", { createDom('input', {
className: "raise", className: 'raise',
id: "raise-exceptions", id: 'raise-exceptions',
type: "checkbox" type: 'checkbox'
}) })
)); ));
var checkbox = find("input"); var checkbox = find('input');
checkbox.checked = !env.catchingExceptions(); checkbox.checked = !env.catchingExceptions();
checkbox.onclick = onRaiseExceptionsClick; checkbox.onclick = onRaiseExceptionsClick;
if (specsExecuted < totalSpecsDefined) { if (specsExecuted < totalSpecsDefined) {
var skippedMessage = "Ran " + specsExecuted + " of " + totalSpecsDefined + " specs - run all"; var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
alert.appendChild( alert.appendChild(
createDom("span", {className: "bar skipped"}, createDom('span', {className: 'bar skipped'},
createDom("a", {href: "?", title: "Run all specs"}, skippedMessage) createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
) )
); );
} }
var statusBarMessage = "" + pluralize("spec", specsExecuted) + ", " + pluralize("failure", failureCount); var statusBarMessage = '' + pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
if (pendingSpecCount) { statusBarMessage += ", " + pluralize("pending spec", pendingSpecCount); } if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
var statusBarClassName = "bar " + ((failureCount > 0) ? "failed" : "passed"); 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); results.appendChild(summary);
summaryList(topResults, summary); summaryList(topResults, summary);
@@ -174,27 +174,27 @@ jasmineRequire.HtmlReporter = function(j$) {
var specListNode; var specListNode;
for (var i = 0; i < resultsTree.children.length; i++) { for (var i = 0; i < resultsTree.children.length; i++) {
var resultNode = resultsTree.children[i]; var resultNode = resultsTree.children[i];
if (resultNode.type == "suite") { if (resultNode.type == 'suite') {
var suiteListNode = createDom("ul", {className: "suite", id: "suite-" + resultNode.result.id}, var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
createDom("li", {className: "suite-detail"}, createDom('li', {className: 'suite-detail'},
createDom("a", {href: specHref(resultNode.result)}, resultNode.result.description) createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
) )
); );
summaryList(resultNode, suiteListNode); summaryList(resultNode, suiteListNode);
domParent.appendChild(suiteListNode); domParent.appendChild(suiteListNode);
} }
if (resultNode.type == "spec") { if (resultNode.type == 'spec') {
if (domParent.getAttribute("class") != "specs") { if (domParent.getAttribute('class') != 'specs') {
specListNode = createDom("ul", {className: "specs"}); specListNode = createDom('ul', {className: 'specs'});
domParent.appendChild(specListNode); domParent.appendChild(specListNode);
} }
specListNode.appendChild( specListNode.appendChild(
createDom("li", { createDom('li', {
className: resultNode.result.status, 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)}, resultNode.result.description)
) )
); );
} }
@@ -203,24 +203,24 @@ jasmineRequire.HtmlReporter = function(j$) {
if (failures.length) { if (failures.length) {
alert.appendChild( alert.appendChild(
createDom('span', {className: "menu bar spec-list"}, createDom('span', {className: 'menu bar spec-list'},
createDom("span", {}, "Spec List | "), createDom('span', {}, 'Spec List | '),
createDom('a', {className: "failures-menu", href: "#"}, "Failures"))); createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
alert.appendChild( alert.appendChild(
createDom('span', {className: "menu bar failure-list"}, createDom('span', {className: 'menu bar failure-list'},
createDom('a', {className: "spec-list-menu", href: "#"}, "Spec List"), createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
createDom("span", {}, " | Failures "))); createDom('span', {}, ' | Failures ')));
find(".failures-menu").onclick = function() { find('.failures-menu').onclick = function() {
setMenuModeTo('failure-list'); setMenuModeTo('failure-list');
}; };
find(".spec-list-menu").onclick = function() { find('.spec-list-menu').onclick = function() {
setMenuModeTo('spec-list'); setMenuModeTo('spec-list');
}; };
setMenuModeTo('failure-list'); setMenuModeTo('failure-list');
var failureNode = find(".failures"); var failureNode = find('.failures');
for (var i = 0; i < failures.length; i++) { for (var i = 0; i < failures.length; i++) {
failureNode.appendChild(failures[i]); failureNode.appendChild(failures[i]);
} }
@@ -249,7 +249,7 @@ jasmineRequire.HtmlReporter = function(j$) {
} }
for (var attr in attrs) { for (var attr in attrs) {
if (attr == "className") { if (attr == 'className') {
el[attr] = attrs[attr]; el[attr] = attrs[attr];
} else { } else {
el.setAttribute(attr, attrs[attr]); el.setAttribute(attr, attrs[attr]);
@@ -260,17 +260,17 @@ jasmineRequire.HtmlReporter = function(j$) {
} }
function pluralize(singular, count) { 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) { function specHref(result) {
return "?spec=" + encodeURIComponent(result.fullName); return '?spec=' + encodeURIComponent(result.fullName);
} }
function setMenuModeTo(mode) { function setMenuModeTo(mode) {
htmlReporterMain.setAttribute("class", "html-reporter " + mode); htmlReporterMain.setAttribute('class', 'html-reporter ' + mode);
} }
} }
@@ -279,7 +279,7 @@ jasmineRequire.HtmlReporter = function(j$) {
jasmineRequire.HtmlSpecFilter = function() { jasmineRequire.HtmlSpecFilter = function() {
function HtmlSpecFilter(options) { 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); var filterPattern = new RegExp(filterString);
this.matches = function(specName) { this.matches = function(specName) {
@@ -328,9 +328,9 @@ jasmineRequire.QueryString = function() {
function toQueryString(paramMap) { function toQueryString(paramMap) {
var qStrPairs = []; var qStrPairs = [];
for (var prop in paramMap) { 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() { function queryStringToParamMap() {
@@ -343,7 +343,7 @@ jasmineRequire.QueryString = function() {
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
var p = params[i].split('='); var p = params[i].split('=');
var value = decodeURIComponent(p[1]); var value = decodeURIComponent(p[1]);
if (value === "true" || value === "false") { if (value === 'true' || value === 'false') {
value = JSON.parse(value); value = JSON.parse(value);
} }
paramMap[decodeURIComponent(p[0])] = value; paramMap[decodeURIComponent(p[0])] = value;

View File

@@ -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. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
function getJasmineRequireObj() { function getJasmineRequireObj() {
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
return exports; return exports;
} else { } else {
window.jasmineRequire = window.jasmineRequire || {}; window.jasmineRequire = window.jasmineRequire || {};
@@ -61,23 +61,23 @@ getJasmineRequireObj().core = function(jRequire) {
getJasmineRequireObj().requireMatchers = function(jRequire, j$) { getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
var availableMatchers = [ var availableMatchers = [
"toBe", 'toBe',
"toBeCloseTo", 'toBeCloseTo',
"toBeDefined", 'toBeDefined',
"toBeFalsy", 'toBeFalsy',
"toBeGreaterThan", 'toBeGreaterThan',
"toBeLessThan", 'toBeLessThan',
"toBeNaN", 'toBeNaN',
"toBeNull", 'toBeNull',
"toBeTruthy", 'toBeTruthy',
"toBeUndefined", 'toBeUndefined',
"toContain", 'toContain',
"toEqual", 'toEqual',
"toHaveBeenCalled", 'toHaveBeenCalled',
"toHaveBeenCalledWith", 'toHaveBeenCalledWith',
"toMatch", 'toMatch',
"toThrow", 'toThrow',
"toThrowError" 'toThrowError'
], ],
matchers = {}; matchers = {};
@@ -90,13 +90,13 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
}; };
getJasmineRequireObj().base = (function (jasmineGlobal) { getJasmineRequireObj().base = (function (jasmineGlobal) {
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
jasmineGlobal = global; jasmineGlobal = global;
} }
return function(j$) { return function(j$) {
j$.unimplementedMethod_ = function() { j$.unimplementedMethod_ = function() {
throw new Error("unimplemented method"); throw new Error('unimplemented method');
}; };
j$.MAX_PRETTY_PRINT_DEPTH = 40; j$.MAX_PRETTY_PRINT_DEPTH = 40;
@@ -113,15 +113,15 @@ getJasmineRequireObj().base = (function (jasmineGlobal) {
}; };
j$.isArray_ = function(value) { j$.isArray_ = function(value) {
return j$.isA_("Array", value); return j$.isA_('Array', value);
}; };
j$.isString_ = function(value) { j$.isString_ = function(value) {
return j$.isA_("String", value); return j$.isA_('String', value);
}; };
j$.isNumber_ = function(value) { j$.isNumber_ = function(value) {
return j$.isA_("Number", value); return j$.isA_('Number', value);
}; };
j$.isA_ = function(typeName, value) { j$.isA_ = function(typeName, value) {
@@ -158,7 +158,7 @@ getJasmineRequireObj().base = (function (jasmineGlobal) {
for (var prop in originalFn) { for (var prop in originalFn) {
if (prop === 'and' || prop === 'calls') { if (prop === 'and' || prop === 'calls') {
throw new Error("Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon"); throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
} }
spy[prop] = originalFn[prop]; spy[prop] = originalFn[prop];
@@ -180,7 +180,7 @@ getJasmineRequireObj().base = (function (jasmineGlobal) {
j$.createSpyObj = function(baseName, methodNames) { j$.createSpyObj = function(baseName, methodNames) {
if (!j$.isArray_(methodNames) || methodNames.length === 0) { if (!j$.isArray_(methodNames) || methodNames.length === 0) {
throw "createSpyObj requires a non-empty array of method names to create spies for"; throw 'createSpyObj requires a non-empty array of method names to create spies for';
} }
var obj = {}; var obj = {};
for (var i = 0; i < methodNames.length; i++) { for (var i = 0; i < methodNames.length; i++) {
@@ -320,10 +320,10 @@ getJasmineRequireObj().Spec = function(j$) {
} }
self.addExpectationResult(false, { self.addExpectationResult(false, {
matcherName: "", matcherName: '',
passed: false, passed: false,
expected: "", expected: '',
actual: "", actual: '',
error: e error: e
}); });
} }
@@ -366,7 +366,7 @@ getJasmineRequireObj().Spec = function(j$) {
return this.getSpecName(this); return this.getSpecName(this);
}; };
Spec.pendingSpecExceptionMessage = "=> marked Pending"; Spec.pendingSpecExceptionMessage = '=> marked Pending';
Spec.isPendingSpecException = function(e) { Spec.isPendingSpecException = function(e) {
return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1); return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
@@ -375,7 +375,7 @@ getJasmineRequireObj().Spec = function(j$) {
return Spec; return Spec;
}; };
if (typeof window == void 0 && typeof exports == "object") { if (typeof window == void 0 && typeof exports == 'object') {
exports.Spec = jasmineRequire.Spec; exports.Spec = jasmineRequire.Spec;
} }
@@ -402,12 +402,12 @@ getJasmineRequireObj().Env = function(j$) {
var currentSuite = null; var currentSuite = null;
var reporter = new j$.ReportDispatcher([ var reporter = new j$.ReportDispatcher([
"jasmineStarted", 'jasmineStarted',
"jasmineDone", 'jasmineDone',
"suiteStarted", 'suiteStarted',
"suiteDone", 'suiteDone',
"specStarted", 'specStarted',
"specDone" 'specDone'
]); ]);
this.specFilter = function() { this.specFilter = function() {
@@ -561,7 +561,7 @@ getJasmineRequireObj().Env = function(j$) {
this.spyOn = function(obj, methodName) { this.spyOn = function(obj, methodName) {
if (j$.util.isUndefined(obj)) { 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])) { if (j$.util.isUndefined(obj[methodName])) {
@@ -619,7 +619,7 @@ getJasmineRequireObj().Env = function(j$) {
} }
if (declarationError) { if (declarationError) {
this.it("encountered a declaration exception", function() { this.it('encountered a declaration exception', function() {
throw declarationError; throw declarationError;
}); });
} }
@@ -726,7 +726,7 @@ getJasmineRequireObj().JsApiReporter = function() {
function JsApiReporter(options) { function JsApiReporter(options) {
var timer = options.timer || noopTimer, var timer = options.timer || noopTimer,
status = "loaded"; status = 'loaded';
this.started = false; this.started = false;
this.finished = false; this.finished = false;
@@ -913,7 +913,7 @@ getJasmineRequireObj().Clock = function() {
self.setTimeout = function(fn, delay, params) { self.setTimeout = function(fn, delay, params) {
if (legacyIE()) { if (legacyIE()) {
if (arguments.length > 2) { 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); return timer.setTimeout(fn, delay);
} }
@@ -923,7 +923,7 @@ getJasmineRequireObj().Clock = function() {
self.setInterval = function(fn, delay, params) { self.setInterval = function(fn, delay, params) {
if (legacyIE()) { if (legacyIE()) {
if (arguments.length > 2) { 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); return timer.setInterval(fn, delay);
} }
@@ -942,7 +942,7 @@ getJasmineRequireObj().Clock = function() {
if (installed) { if (installed) {
delayedFunctionScheduler.tick(millis); delayedFunctionScheduler.tick(millis);
} else { } 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()');
} }
}; };
@@ -1141,11 +1141,11 @@ getJasmineRequireObj().ExceptionFormatter = function() {
} }
if (error.fileName || error.sourceURL) { if (error.fileName || error.sourceURL) {
message += " in " + (error.fileName || error.sourceURL); message += ' in ' + (error.fileName || error.sourceURL);
} }
if (error.line || error.lineNumber) { if (error.line || error.lineNumber) {
message += " (line " + (error.line || error.lineNumber) + ")"; message += ' (line ' + (error.line || error.lineNumber) + ')';
} }
return message; return message;
@@ -1179,7 +1179,7 @@ getJasmineRequireObj().Expectation = function() {
return function() { return function() {
var args = Array.prototype.slice.call(arguments, 0), var args = Array.prototype.slice.call(arguments, 0),
expected = args.slice(0), expected = args.slice(0),
message = ""; message = '';
args.unshift(this.actual); args.unshift(this.actual);
@@ -1204,7 +1204,7 @@ getJasmineRequireObj().Expectation = function() {
args.unshift(name); args.unshift(name);
message = this.util.buildFailureMessage.apply(null, args); message = this.util.buildFailureMessage.apply(null, args);
} else { } else {
if (Object.prototype.toString.apply(result.message) === "[object Function]") { if (Object.prototype.toString.apply(result.message) === '[object Function]') {
message = result.message(); message = result.message();
} else { } else {
message = result.message; message = result.message;
@@ -1284,18 +1284,18 @@ getJasmineRequireObj().buildExpectationResult = function() {
function message() { function message() {
if (options.passed) { if (options.passed) {
return "Passed."; return 'Passed.';
} else if (options.message) { } else if (options.message) {
return options.message; return options.message;
} else if (options.error) { } else if (options.error) {
return messageFormatter(options.error); return messageFormatter(options.error);
} }
return ""; return '';
} }
function stack() { function stack() {
if (options.passed) { if (options.passed) {
return ""; return '';
} }
var error = options.error; var error = options.error;
@@ -1320,7 +1320,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
} }
ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) { 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 || []; mismatchKeys = mismatchKeys || [];
mismatchValues = mismatchValues || []; mismatchValues = mismatchValues || [];
@@ -1331,10 +1331,10 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
for (var property in this.sample) { for (var property in this.sample) {
if (!hasKey(other, property) && hasKey(this.sample, property)) { 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])) { 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."); 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.');
} }
} }
@@ -1342,7 +1342,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}; };
ObjectContaining.prototype.jasmineToString = function() { ObjectContaining.prototype.jasmineToString = function() {
return "<jasmine.objectContaining(" + j$.pp(this.sample) + ")>"; return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
}; };
return ObjectContaining; return ObjectContaining;
@@ -1370,7 +1370,7 @@ getJasmineRequireObj().pp = function(j$) {
} else if (typeof value === 'string') { } else if (typeof value === 'string') {
this.emitString(value); this.emitString(value);
} else if (j$.isSpy(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) { } else if (value instanceof RegExp) {
this.emitScalar(value.toString()); this.emitScalar(value.toString());
} else if (typeof value === 'function') { } else if (typeof value === 'function') {
@@ -1424,12 +1424,12 @@ getJasmineRequireObj().pp = function(j$) {
}; };
StringPrettyPrinter.prototype.emitString = function(value) { StringPrettyPrinter.prototype.emitString = function(value) {
this.append("'" + value + "'"); this.append('\'' + value + '\'');
}; };
StringPrettyPrinter.prototype.emitArray = function(array) { StringPrettyPrinter.prototype.emitArray = function(array) {
if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
this.append("Array"); this.append('Array');
return; return;
} }
@@ -1445,7 +1445,7 @@ getJasmineRequireObj().pp = function(j$) {
StringPrettyPrinter.prototype.emitObject = function(obj) { StringPrettyPrinter.prototype.emitObject = function(obj) {
if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
this.append("Object"); this.append('Object');
return; return;
} }
@@ -1591,7 +1591,7 @@ getJasmineRequireObj().SpyStrategy = function() {
function SpyStrategy(options) { function SpyStrategy(options) {
options = options || {}; options = options || {};
var identity = options.name || "unknown", var identity = options.name || 'unknown',
originalFn = options.fn || function() {}, originalFn = options.fn || function() {},
getSpy = options.getSpy || function() {}, getSpy = options.getSpy || function() {},
plan = function() {}; plan = function() {};
@@ -1725,7 +1725,7 @@ getJasmineRequireObj().Suite = function() {
return Suite; return Suite;
}; };
if (typeof window == void 0 && typeof exports == "object") { if (typeof window == void 0 && typeof exports == 'object') {
exports.Suite = jasmineRequire.Suite; exports.Suite = jasmineRequire.Suite;
} }
@@ -1765,7 +1765,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
contains: function(haystack, needle, customTesters) { contains: function(haystack, needle, customTesters) {
customTesters = 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++) { for (var i = 0; i < haystack.length; i++) {
if (eq(haystack[i], needle, [], [], customTesters)) { if (eq(haystack[i], needle, [], [], customTesters)) {
return true; return true;
@@ -1784,21 +1784,21 @@ getJasmineRequireObj().matchersUtil = function(j$) {
expected = args.slice(3), expected = args.slice(3),
englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
var message = "Expected " + var message = 'Expected ' +
j$.pp(actual) + j$.pp(actual) +
(isNot ? " not " : " ") + (isNot ? ' not ' : ' ') +
englishyPredicate; englishyPredicate;
if (expected.length > 0) { if (expected.length > 0) {
for (var i = 0; i < expected.length; i++) { for (var i = 0; i < expected.length; i++) {
if (i > 0) { if (i > 0) {
message += ","; message += ',';
} }
message += " " + j$.pp(expected[i]); message += ' ' + j$.pp(expected[i]);
} }
} }
return message + "."; return message + '.';
} }
}; };
@@ -2035,9 +2035,9 @@ getJasmineRequireObj().toBeNaN = function(j$) {
}; };
if (result.pass) { if (result.pass) {
result.message = "Expected actual not to be NaN."; result.message = 'Expected actual not to be NaN.';
} else { } else {
result.message = function() { return "Expected " + j$.pp(actual) + " to be NaN."; }; result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; };
} }
return result; return result;
@@ -2149,8 +2149,8 @@ getJasmineRequireObj().toHaveBeenCalled = function(j$) {
result.pass = actual.calls.any(); result.pass = actual.calls.any();
result.message = result.pass ? result.message = result.pass ?
"Expected spy " + actual.and.identity() + " not to have been called." : 'Expected spy ' + actual.and.identity() + ' not to have been called.' :
"Expected spy " + actual.and.identity() + " to have been called."; 'Expected spy ' + actual.and.identity() + ' to have been called.';
return result; return result;
} }
@@ -2175,15 +2175,15 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
} }
if (!actual.calls.any()) { if (!actual.calls.any()) {
result.message = function() { return "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; return result;
} }
if (util.contains(actual.calls.allArgs(), expectedArgs)) { if (util.contains(actual.calls.allArgs(), expectedArgs)) {
result.pass = true; result.pass = true;
result.message = function() { return "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 { } else {
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, '') + "."; }; 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; return result;
@@ -2220,8 +2220,8 @@ getJasmineRequireObj().toThrow = function(j$) {
threw = false, threw = false,
thrown; thrown;
if (typeof actual != "function") { if (typeof actual != 'function') {
throw new Error("Actual is not a Function"); throw new Error('Actual is not a Function');
} }
try { try {
@@ -2232,22 +2232,22 @@ getJasmineRequireObj().toThrow = function(j$) {
} }
if (!threw) { if (!threw) {
result.message = "Expected function to throw an exception."; result.message = 'Expected function to throw an exception.';
return result; return result;
} }
if (arguments.length == 1) { if (arguments.length == 1) {
result.pass = true; result.pass = true;
result.message = function() { return "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; return result;
} }
if (util.equals(thrown, expected)) { if (util.equals(thrown, expected)) {
result.pass = true; result.pass = true;
result.message = function() { return "Expected function not to throw " + j$.pp(expected) + "."; }; result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; };
} else { } else {
result.message = function() { return "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; return result;
@@ -2272,8 +2272,8 @@ getJasmineRequireObj().toThrowError = function(j$) {
name, name,
constructorName; constructorName;
if (typeof actual != "function") { if (typeof actual != 'function') {
throw new Error("Actual is not a Function"); throw new Error('Actual is not a Function');
} }
extractExpectedParams.apply(null, arguments); extractExpectedParams.apply(null, arguments);
@@ -2286,17 +2286,17 @@ getJasmineRequireObj().toThrowError = function(j$) {
} }
if (!threw) { if (!threw) {
fail.message = "Expected function to throw an Error."; fail.message = 'Expected function to throw an Error.';
return fail; return fail;
} }
if (!(thrown instanceof Error)) { if (!(thrown instanceof Error)) {
fail.message = function() { return "Expected function to throw an Error, but it threw " + j$.pp(thrown) + "."; }; fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; };
return fail; return fail;
} }
if (arguments.length == 1) { if (arguments.length == 1) {
pass.message = "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; return pass;
} }
@@ -2307,54 +2307,54 @@ getJasmineRequireObj().toThrowError = function(j$) {
if (errorType && message) { if (errorType && message) {
if (thrown.constructor == errorType && util.equals(thrown.message, message)) { if (thrown.constructor == errorType && util.equals(thrown.message, message)) {
pass.message = function() { return "Expected function not to throw " + name + " with message " + j$.pp(message) + "."; }; pass.message = function() { return 'Expected function not to throw ' + name + ' with message ' + j$.pp(message) + '.'; };
return pass; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw " + name + " with message " + j$.pp(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) + "."; }; ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
if (errorType && regexp) { if (errorType && regexp) {
if (thrown.constructor == errorType && regexp.test(thrown.message)) { if (thrown.constructor == errorType && regexp.test(thrown.message)) {
pass.message = function() { return "Expected function not to throw " + name + " with message matching " + j$.pp(regexp) + "."; }; pass.message = function() { return 'Expected function not to throw ' + name + ' with message matching ' + j$.pp(regexp) + '.'; };
return pass; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw " + name + " with message matching " + j$.pp(regexp) + 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) + "."; }; ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
if (errorType) { if (errorType) {
if (thrown.constructor == errorType) { if (thrown.constructor == errorType) {
pass.message = "Expected function not to throw " + name + "."; pass.message = 'Expected function not to throw ' + name + '.';
return pass; return pass;
} else { } else {
fail.message = "Expected function to throw " + name + ", but it threw " + constructorName + "."; fail.message = 'Expected function to throw ' + name + ', but it threw ' + constructorName + '.';
return fail; return fail;
} }
} }
if (message) { if (message) {
if (thrown.message == message) { if (thrown.message == message) {
pass.message = function() { return "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; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw an exception with message " + j$.pp(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) + "."; }; ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
if (regexp) { if (regexp) {
if (regexp.test(thrown.message)) { if (regexp.test(thrown.message)) {
pass.message = function() { return "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; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw an exception with a message matching " + j$.pp(regexp) + 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) + "."; }; ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
@@ -2373,34 +2373,34 @@ getJasmineRequireObj().toThrowError = function(j$) {
if (expected instanceof RegExp) { if (expected instanceof RegExp) {
regexp = expected; regexp = expected;
} else if (typeof expected == "string") { } else if (typeof expected == 'string') {
message = expected; message = expected;
} else if (checkForAnErrorType(expected)) { } else if (checkForAnErrorType(expected)) {
errorType = expected; errorType = expected;
} }
if (!(errorType || message || regexp)) { 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 { } else {
if (checkForAnErrorType(arguments[1])) { if (checkForAnErrorType(arguments[1])) {
errorType = arguments[1]; errorType = arguments[1];
} else { } 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) { if (arguments[2] instanceof RegExp) {
regexp = arguments[2]; regexp = arguments[2];
} else if (typeof arguments[2] == "string") { } else if (typeof arguments[2] == 'string') {
message = arguments[2]; message = arguments[2];
} else { } 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) { function checkForAnErrorType(type) {
if (typeof type !== "function") { if (typeof type !== 'function') {
return false; return false;
} }
@@ -2416,5 +2416,5 @@ getJasmineRequireObj().toThrowError = function(j$) {
}; };
getJasmineRequireObj().version = function() { getJasmineRequireObj().version = function() {
return "2.0.0"; return '2.0.0';
}; };

View File

@@ -25,7 +25,7 @@ getJasmineRequireObj().ConsoleReporter = function() {
specCount = 0; specCount = 0;
failureCount = 0; failureCount = 0;
pendingCount = 0; pendingCount = 0;
print("Started"); print('Started');
printNewline(); printNewline();
timer.start(); timer.start();
}; };
@@ -37,18 +37,18 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
printNewline(); printNewline();
var specCounts = specCount + " " + plural("spec", specCount) + ", " + var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' +
failureCount + " " + plural("failure", failureCount); failureCount + ' ' + plural('failure', failureCount);
if (pendingCount) { if (pendingCount) {
specCounts += ", " + pendingCount + " pending " + plural("spec", pendingCount); specCounts += ', ' + pendingCount + ' pending ' + plural('spec', pendingCount);
} }
print(specCounts); print(specCounts);
printNewline(); printNewline();
var seconds = timer.elapsed() / 1000; var seconds = timer.elapsed() / 1000;
print("Finished in " + seconds + " " + plural("second", seconds)); print('Finished in ' + seconds + ' ' + plural('second', seconds));
printNewline(); printNewline();
@@ -58,28 +58,28 @@ getJasmineRequireObj().ConsoleReporter = function() {
this.specDone = function(result) { this.specDone = function(result) {
specCount++; specCount++;
if (result.status == "pending") { if (result.status == 'pending') {
pendingCount++; pendingCount++;
print(colored("yellow", "*")); print(colored('yellow', '*'));
return; return;
} }
if (result.status == "passed") { if (result.status == 'passed') {
print(colored("green", '.')); print(colored('green', '.'));
return; return;
} }
if (result.status == "failed") { if (result.status == 'failed') {
failureCount++; failureCount++;
failedSpecs.push(result); failedSpecs.push(result);
print(colored("red", 'F')); print(colored('red', 'F'));
} }
}; };
return this; return this;
function printNewline() { function printNewline() {
print("\n"); print('\n');
} }
function colored(color, str) { function colored(color, str) {
@@ -87,7 +87,7 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
function plural(str, count) { function plural(str, count) {
return count == 1 ? str : str + "s"; return count == 1 ? str : str + 's';
} }
function repeat(thing, times) { function repeat(thing, times) {
@@ -99,12 +99,12 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
function indent(str, spaces) { function indent(str, spaces) {
var lines = (str || '').split("\n"); var lines = (str || '').split('\n');
var newArr = []; var newArr = [];
for (var i = 0; i < lines.length; i++) { 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) { function specFailureDetails(result) {

View File

@@ -1,5 +1,5 @@
function getJasmineRequireObj() { function getJasmineRequireObj() {
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
return exports; return exports;
} else { } else {
window.jasmineRequire = window.jasmineRequire || {}; window.jasmineRequire = window.jasmineRequire || {};

View File

@@ -32,7 +32,7 @@ getJasmineRequireObj().Clock = function() {
self.setTimeout = function(fn, delay, params) { self.setTimeout = function(fn, delay, params) {
if (legacyIE()) { if (legacyIE()) {
if (arguments.length > 2) { 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); return timer.setTimeout(fn, delay);
} }
@@ -42,7 +42,7 @@ getJasmineRequireObj().Clock = function() {
self.setInterval = function(fn, delay, params) { self.setInterval = function(fn, delay, params) {
if (legacyIE()) { if (legacyIE()) {
if (arguments.length > 2) { 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); return timer.setInterval(fn, delay);
} }
@@ -61,7 +61,7 @@ getJasmineRequireObj().Clock = function() {
if (installed) { if (installed) {
delayedFunctionScheduler.tick(millis); delayedFunctionScheduler.tick(millis);
} else { } 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()');
} }
}; };

View File

@@ -21,12 +21,12 @@ getJasmineRequireObj().Env = function(j$) {
var currentSuite = null; var currentSuite = null;
var reporter = new j$.ReportDispatcher([ var reporter = new j$.ReportDispatcher([
"jasmineStarted", 'jasmineStarted',
"jasmineDone", 'jasmineDone',
"suiteStarted", 'suiteStarted',
"suiteDone", 'suiteDone',
"specStarted", 'specStarted',
"specDone" 'specDone'
]); ]);
this.specFilter = function() { this.specFilter = function() {
@@ -180,7 +180,7 @@ getJasmineRequireObj().Env = function(j$) {
this.spyOn = function(obj, methodName) { this.spyOn = function(obj, methodName) {
if (j$.util.isUndefined(obj)) { 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])) { if (j$.util.isUndefined(obj[methodName])) {
@@ -238,7 +238,7 @@ getJasmineRequireObj().Env = function(j$) {
} }
if (declarationError) { if (declarationError) {
this.it("encountered a declaration exception", function() { this.it('encountered a declaration exception', function() {
throw declarationError; throw declarationError;
}); });
} }

View File

@@ -10,11 +10,11 @@ getJasmineRequireObj().ExceptionFormatter = function() {
} }
if (error.fileName || error.sourceURL) { if (error.fileName || error.sourceURL) {
message += " in " + (error.fileName || error.sourceURL); message += ' in ' + (error.fileName || error.sourceURL);
} }
if (error.line || error.lineNumber) { if (error.line || error.lineNumber) {
message += " (line " + (error.line || error.lineNumber) + ")"; message += ' (line ' + (error.line || error.lineNumber) + ')';
} }
return message; return message;

View File

@@ -18,7 +18,7 @@ getJasmineRequireObj().Expectation = function() {
return function() { return function() {
var args = Array.prototype.slice.call(arguments, 0), var args = Array.prototype.slice.call(arguments, 0),
expected = args.slice(0), expected = args.slice(0),
message = ""; message = '';
args.unshift(this.actual); args.unshift(this.actual);
@@ -43,7 +43,7 @@ getJasmineRequireObj().Expectation = function() {
args.unshift(name); args.unshift(name);
message = this.util.buildFailureMessage.apply(null, args); message = this.util.buildFailureMessage.apply(null, args);
} else { } else {
if (Object.prototype.toString.apply(result.message) === "[object Function]") { if (Object.prototype.toString.apply(result.message) === '[object Function]') {
message = result.message(); message = result.message();
} else { } else {
message = result.message; message = result.message;

View File

@@ -15,18 +15,18 @@ getJasmineRequireObj().buildExpectationResult = function() {
function message() { function message() {
if (options.passed) { if (options.passed) {
return "Passed."; return 'Passed.';
} else if (options.message) { } else if (options.message) {
return options.message; return options.message;
} else if (options.error) { } else if (options.error) {
return messageFormatter(options.error); return messageFormatter(options.error);
} }
return ""; return '';
} }
function stack() { function stack() {
if (options.passed) { if (options.passed) {
return ""; return '';
} }
var error = options.error; var error = options.error;

View File

@@ -7,7 +7,7 @@ getJasmineRequireObj().JsApiReporter = function() {
function JsApiReporter(options) { function JsApiReporter(options) {
var timer = options.timer || noopTimer, var timer = options.timer || noopTimer,
status = "loaded"; status = 'loaded';
this.started = false; this.started = false;
this.finished = false; this.finished = false;

View File

@@ -5,7 +5,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
} }
ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) { 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 || []; mismatchKeys = mismatchKeys || [];
mismatchValues = mismatchValues || []; mismatchValues = mismatchValues || [];
@@ -16,10 +16,10 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
for (var property in this.sample) { for (var property in this.sample) {
if (!hasKey(other, property) && hasKey(this.sample, property)) { 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])) { 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."); 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.');
} }
} }
@@ -27,7 +27,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}; };
ObjectContaining.prototype.jasmineToString = function() { ObjectContaining.prototype.jasmineToString = function() {
return "<jasmine.objectContaining(" + j$.pp(this.sample) + ")>"; return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
}; };
return ObjectContaining; return ObjectContaining;

View File

@@ -20,7 +20,7 @@ getJasmineRequireObj().pp = function(j$) {
} else if (typeof value === 'string') { } else if (typeof value === 'string') {
this.emitString(value); this.emitString(value);
} else if (j$.isSpy(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) { } else if (value instanceof RegExp) {
this.emitScalar(value.toString()); this.emitScalar(value.toString());
} else if (typeof value === 'function') { } else if (typeof value === 'function') {
@@ -74,12 +74,12 @@ getJasmineRequireObj().pp = function(j$) {
}; };
StringPrettyPrinter.prototype.emitString = function(value) { StringPrettyPrinter.prototype.emitString = function(value) {
this.append("'" + value + "'"); this.append('\'' + value + '\'');
}; };
StringPrettyPrinter.prototype.emitArray = function(array) { StringPrettyPrinter.prototype.emitArray = function(array) {
if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
this.append("Array"); this.append('Array');
return; return;
} }
@@ -95,7 +95,7 @@ getJasmineRequireObj().pp = function(j$) {
StringPrettyPrinter.prototype.emitObject = function(obj) { StringPrettyPrinter.prototype.emitObject = function(obj) {
if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
this.append("Object"); this.append('Object');
return; return;
} }

View File

@@ -92,10 +92,10 @@ getJasmineRequireObj().Spec = function(j$) {
} }
self.addExpectationResult(false, { self.addExpectationResult(false, {
matcherName: "", matcherName: '',
passed: false, passed: false,
expected: "", expected: '',
actual: "", actual: '',
error: e error: e
}); });
} }
@@ -138,7 +138,7 @@ getJasmineRequireObj().Spec = function(j$) {
return this.getSpecName(this); return this.getSpecName(this);
}; };
Spec.pendingSpecExceptionMessage = "=> marked Pending"; Spec.pendingSpecExceptionMessage = '=> marked Pending';
Spec.isPendingSpecException = function(e) { Spec.isPendingSpecException = function(e) {
return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1); return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
@@ -147,6 +147,6 @@ getJasmineRequireObj().Spec = function(j$) {
return Spec; return Spec;
}; };
if (typeof window == void 0 && typeof exports == "object") { if (typeof window == void 0 && typeof exports == 'object') {
exports.Spec = jasmineRequire.Spec; exports.Spec = jasmineRequire.Spec;
} }

View File

@@ -3,7 +3,7 @@ getJasmineRequireObj().SpyStrategy = function() {
function SpyStrategy(options) { function SpyStrategy(options) {
options = options || {}; options = options || {};
var identity = options.name || "unknown", var identity = options.name || 'unknown',
originalFn = options.fn || function() {}, originalFn = options.fn || function() {},
getSpy = options.getSpy || function() {}, getSpy = options.getSpy || function() {},
plan = function() {}; plan = function() {};

View File

@@ -85,6 +85,6 @@ getJasmineRequireObj().Suite = function() {
return Suite; return Suite;
}; };
if (typeof window == void 0 && typeof exports == "object") { if (typeof window == void 0 && typeof exports == 'object') {
exports.Suite = jasmineRequire.Suite; exports.Suite = jasmineRequire.Suite;
} }

View File

@@ -1,11 +1,11 @@
getJasmineRequireObj().base = (function (jasmineGlobal) { getJasmineRequireObj().base = (function (jasmineGlobal) {
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
jasmineGlobal = global; jasmineGlobal = global;
} }
return function(j$) { return function(j$) {
j$.unimplementedMethod_ = function() { j$.unimplementedMethod_ = function() {
throw new Error("unimplemented method"); throw new Error('unimplemented method');
}; };
j$.MAX_PRETTY_PRINT_DEPTH = 40; j$.MAX_PRETTY_PRINT_DEPTH = 40;
@@ -22,15 +22,15 @@ getJasmineRequireObj().base = (function (jasmineGlobal) {
}; };
j$.isArray_ = function(value) { j$.isArray_ = function(value) {
return j$.isA_("Array", value); return j$.isA_('Array', value);
}; };
j$.isString_ = function(value) { j$.isString_ = function(value) {
return j$.isA_("String", value); return j$.isA_('String', value);
}; };
j$.isNumber_ = function(value) { j$.isNumber_ = function(value) {
return j$.isA_("Number", value); return j$.isA_('Number', value);
}; };
j$.isA_ = function(typeName, value) { j$.isA_ = function(typeName, value) {
@@ -67,7 +67,7 @@ getJasmineRequireObj().base = (function (jasmineGlobal) {
for (var prop in originalFn) { for (var prop in originalFn) {
if (prop === 'and' || prop === 'calls') { if (prop === 'and' || prop === 'calls') {
throw new Error("Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon"); throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
} }
spy[prop] = originalFn[prop]; spy[prop] = originalFn[prop];
@@ -89,7 +89,7 @@ getJasmineRequireObj().base = (function (jasmineGlobal) {
j$.createSpyObj = function(baseName, methodNames) { j$.createSpyObj = function(baseName, methodNames) {
if (!j$.isArray_(methodNames) || methodNames.length === 0) { if (!j$.isArray_(methodNames) || methodNames.length === 0) {
throw "createSpyObj requires a non-empty array of method names to create spies for"; throw 'createSpyObj requires a non-empty array of method names to create spies for';
} }
var obj = {}; var obj = {};
for (var i = 0; i < methodNames.length; i++) { for (var i = 0; i < methodNames.length; i++) {

View File

@@ -11,7 +11,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
contains: function(haystack, needle, customTesters) { contains: function(haystack, needle, customTesters) {
customTesters = 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++) { for (var i = 0; i < haystack.length; i++) {
if (eq(haystack[i], needle, [], [], customTesters)) { if (eq(haystack[i], needle, [], [], customTesters)) {
return true; return true;
@@ -30,21 +30,21 @@ getJasmineRequireObj().matchersUtil = function(j$) {
expected = args.slice(3), expected = args.slice(3),
englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
var message = "Expected " + var message = 'Expected ' +
j$.pp(actual) + j$.pp(actual) +
(isNot ? " not " : " ") + (isNot ? ' not ' : ' ') +
englishyPredicate; englishyPredicate;
if (expected.length > 0) { if (expected.length > 0) {
for (var i = 0; i < expected.length; i++) { for (var i = 0; i < expected.length; i++) {
if (i > 0) { if (i > 0) {
message += ","; message += ',';
} }
message += " " + j$.pp(expected[i]); message += ' ' + j$.pp(expected[i]);
} }
} }
return message + "."; return message + '.';
} }
}; };

View File

@@ -1,22 +1,22 @@
getJasmineRequireObj().requireMatchers = function(jRequire, j$) { getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
var availableMatchers = [ var availableMatchers = [
"toBe", 'toBe',
"toBeCloseTo", 'toBeCloseTo',
"toBeDefined", 'toBeDefined',
"toBeFalsy", 'toBeFalsy',
"toBeGreaterThan", 'toBeGreaterThan',
"toBeLessThan", 'toBeLessThan',
"toBeNaN", 'toBeNaN',
"toBeNull", 'toBeNull',
"toBeTruthy", 'toBeTruthy',
"toBeUndefined", 'toBeUndefined',
"toContain", 'toContain',
"toEqual", 'toEqual',
"toHaveBeenCalled", 'toHaveBeenCalled',
"toHaveBeenCalledWith", 'toHaveBeenCalledWith',
"toMatch", 'toMatch',
"toThrow", 'toThrow',
"toThrowError" 'toThrowError'
], ],
matchers = {}; matchers = {};

View File

@@ -8,9 +8,9 @@ getJasmineRequireObj().toBeNaN = function(j$) {
}; };
if (result.pass) { if (result.pass) {
result.message = "Expected actual not to be NaN."; result.message = 'Expected actual not to be NaN.';
} else { } else {
result.message = function() { return "Expected " + j$.pp(actual) + " to be NaN."; }; result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; };
} }
return result; return result;

View File

@@ -16,8 +16,8 @@ getJasmineRequireObj().toHaveBeenCalled = function(j$) {
result.pass = actual.calls.any(); result.pass = actual.calls.any();
result.message = result.pass ? result.message = result.pass ?
"Expected spy " + actual.and.identity() + " not to have been called." : 'Expected spy ' + actual.and.identity() + ' not to have been called.' :
"Expected spy " + actual.and.identity() + " to have been called."; 'Expected spy ' + actual.and.identity() + ' to have been called.';
return result; return result;
} }

View File

@@ -13,15 +13,15 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
} }
if (!actual.calls.any()) { if (!actual.calls.any()) {
result.message = function() { return "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; return result;
} }
if (util.contains(actual.calls.allArgs(), expectedArgs)) { if (util.contains(actual.calls.allArgs(), expectedArgs)) {
result.pass = true; result.pass = true;
result.message = function() { return "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 { } else {
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, '') + "."; }; 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; return result;

View File

@@ -7,8 +7,8 @@ getJasmineRequireObj().toThrow = function(j$) {
threw = false, threw = false,
thrown; thrown;
if (typeof actual != "function") { if (typeof actual != 'function') {
throw new Error("Actual is not a Function"); throw new Error('Actual is not a Function');
} }
try { try {
@@ -19,22 +19,22 @@ getJasmineRequireObj().toThrow = function(j$) {
} }
if (!threw) { if (!threw) {
result.message = "Expected function to throw an exception."; result.message = 'Expected function to throw an exception.';
return result; return result;
} }
if (arguments.length == 1) { if (arguments.length == 1) {
result.pass = true; result.pass = true;
result.message = function() { return "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; return result;
} }
if (util.equals(thrown, expected)) { if (util.equals(thrown, expected)) {
result.pass = true; result.pass = true;
result.message = function() { return "Expected function not to throw " + j$.pp(expected) + "."; }; result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; };
} else { } else {
result.message = function() { return "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; return result;

View File

@@ -12,8 +12,8 @@ getJasmineRequireObj().toThrowError = function(j$) {
name, name,
constructorName; constructorName;
if (typeof actual != "function") { if (typeof actual != 'function') {
throw new Error("Actual is not a Function"); throw new Error('Actual is not a Function');
} }
extractExpectedParams.apply(null, arguments); extractExpectedParams.apply(null, arguments);
@@ -26,17 +26,17 @@ getJasmineRequireObj().toThrowError = function(j$) {
} }
if (!threw) { if (!threw) {
fail.message = "Expected function to throw an Error."; fail.message = 'Expected function to throw an Error.';
return fail; return fail;
} }
if (!(thrown instanceof Error)) { if (!(thrown instanceof Error)) {
fail.message = function() { return "Expected function to throw an Error, but it threw " + j$.pp(thrown) + "."; }; fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; };
return fail; return fail;
} }
if (arguments.length == 1) { if (arguments.length == 1) {
pass.message = "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; return pass;
} }
@@ -47,54 +47,54 @@ getJasmineRequireObj().toThrowError = function(j$) {
if (errorType && message) { if (errorType && message) {
if (thrown.constructor == errorType && util.equals(thrown.message, message)) { if (thrown.constructor == errorType && util.equals(thrown.message, message)) {
pass.message = function() { return "Expected function not to throw " + name + " with message " + j$.pp(message) + "."; }; pass.message = function() { return 'Expected function not to throw ' + name + ' with message ' + j$.pp(message) + '.'; };
return pass; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw " + name + " with message " + j$.pp(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) + "."; }; ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
if (errorType && regexp) { if (errorType && regexp) {
if (thrown.constructor == errorType && regexp.test(thrown.message)) { if (thrown.constructor == errorType && regexp.test(thrown.message)) {
pass.message = function() { return "Expected function not to throw " + name + " with message matching " + j$.pp(regexp) + "."; }; pass.message = function() { return 'Expected function not to throw ' + name + ' with message matching ' + j$.pp(regexp) + '.'; };
return pass; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw " + name + " with message matching " + j$.pp(regexp) + 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) + "."; }; ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
if (errorType) { if (errorType) {
if (thrown.constructor == errorType) { if (thrown.constructor == errorType) {
pass.message = "Expected function not to throw " + name + "."; pass.message = 'Expected function not to throw ' + name + '.';
return pass; return pass;
} else { } else {
fail.message = "Expected function to throw " + name + ", but it threw " + constructorName + "."; fail.message = 'Expected function to throw ' + name + ', but it threw ' + constructorName + '.';
return fail; return fail;
} }
} }
if (message) { if (message) {
if (thrown.message == message) { if (thrown.message == message) {
pass.message = function() { return "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; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw an exception with message " + j$.pp(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) + "."; }; ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
if (regexp) { if (regexp) {
if (regexp.test(thrown.message)) { if (regexp.test(thrown.message)) {
pass.message = function() { return "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; return pass;
} else { } else {
fail.message = function() { return "Expected function to throw an exception with a message matching " + j$.pp(regexp) + 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) + "."; }; ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
return fail; return fail;
} }
} }
@@ -113,34 +113,34 @@ getJasmineRequireObj().toThrowError = function(j$) {
if (expected instanceof RegExp) { if (expected instanceof RegExp) {
regexp = expected; regexp = expected;
} else if (typeof expected == "string") { } else if (typeof expected == 'string') {
message = expected; message = expected;
} else if (checkForAnErrorType(expected)) { } else if (checkForAnErrorType(expected)) {
errorType = expected; errorType = expected;
} }
if (!(errorType || message || regexp)) { 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 { } else {
if (checkForAnErrorType(arguments[1])) { if (checkForAnErrorType(arguments[1])) {
errorType = arguments[1]; errorType = arguments[1];
} else { } 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) { if (arguments[2] instanceof RegExp) {
regexp = arguments[2]; regexp = arguments[2];
} else if (typeof arguments[2] == "string") { } else if (typeof arguments[2] == 'string') {
message = arguments[2]; message = arguments[2];
} else { } 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) { function checkForAnErrorType(type) {
if (typeof type !== "function") { if (typeof type !== 'function') {
return false; return false;
} }

View File

@@ -1,5 +1,5 @@
function getJasmineRequireObj() { function getJasmineRequireObj() {
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
return exports; return exports;
} else { } else {
window.jasmineRequire = window.jasmineRequire || {}; window.jasmineRequire = window.jasmineRequire || {};

View File

@@ -20,20 +20,20 @@ jasmineRequire.HtmlReporter = function(j$) {
symbols; symbols;
this.initialize = function() { this.initialize = function() {
htmlReporterMain = createDom("div", {className: "html-reporter"}, htmlReporterMain = createDom('div', {className: 'html-reporter'},
createDom("div", {className: "banner"}, createDom('div', {className: 'banner'},
createDom("span", {className: "title"}, "Jasmine"), createDom('span', {className: 'title'}, 'Jasmine'),
createDom("span", {className: "version"}, j$.version) createDom('span', {className: 'version'}, j$.version)
), ),
createDom("ul", {className: "symbol-summary"}), createDom('ul', {className: 'symbol-summary'}),
createDom("div", {className: "alert"}), createDom('div', {className: 'alert'}),
createDom("div", {className: "results"}, createDom('div', {className: 'results'},
createDom("div", {className: "failures"}) createDom('div', {className: 'failures'})
) )
); );
getContainer().appendChild(htmlReporterMain); getContainer().appendChild(htmlReporterMain);
symbols = find(".symbol-summary"); symbols = find('.symbol-summary');
}; };
var totalSpecsDefined; var totalSpecsDefined;
@@ -42,13 +42,13 @@ jasmineRequire.HtmlReporter = function(j$) {
timer.start(); 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; currentParent = topResults;
this.suiteStarted = function(result) { this.suiteStarted = function(result) {
currentParent.addChild(result, "suite"); currentParent.addChild(result, 'suite');
currentParent = currentParent.last(); currentParent = currentParent.last();
}; };
@@ -61,82 +61,82 @@ jasmineRequire.HtmlReporter = function(j$) {
}; };
this.specStarted = function(result) { this.specStarted = function(result) {
currentParent.addChild(result, "spec"); currentParent.addChild(result, 'spec');
}; };
var failures = []; var failures = [];
this.specDone = function(result) { this.specDone = function(result) {
if (result.status != "disabled") { if (result.status != 'disabled') {
specsExecuted++; specsExecuted++;
} }
symbols.appendChild(createDom("li", { symbols.appendChild(createDom('li', {
className: result.status, className: result.status,
id: "spec_" + result.id, id: 'spec_' + result.id,
title: result.fullName title: result.fullName
} }
)); ));
if (result.status == "failed") { if (result.status == 'failed') {
failureCount++; failureCount++;
var failure = var failure =
createDom("div", {className: "spec-detail failed"}, createDom('div', {className: 'spec-detail failed'},
createDom("div", {className: "description"}, createDom('div', {className: 'description'},
createDom("a", {title: result.fullName, href: specHref(result)}, result.fullName) createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
), ),
createDom("div", {className: "messages"}) createDom('div', {className: 'messages'})
); );
var messages = failure.childNodes[1]; var messages = failure.childNodes[1];
for (var i = 0; i < result.failedExpectations.length; i++) { for (var i = 0; i < result.failedExpectations.length; i++) {
var expectation = result.failedExpectations[i]; var expectation = result.failedExpectations[i];
messages.appendChild(createDom("div", {className: "result-message"}, expectation.message)); messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
messages.appendChild(createDom("div", {className: "stack-trace"}, expectation.stack)); messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
} }
failures.push(failure); failures.push(failure);
} }
if (result.status == "pending") { if (result.status == 'pending') {
pendingSpecCount++; pendingSpecCount++;
} }
}; };
this.jasmineDone = function() { this.jasmineDone = function() {
var banner = find(".banner"); var banner = find('.banner');
banner.appendChild(createDom("span", {className: "duration"}, "finished in " + timer.elapsed() / 1000 + "s")); 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" }, alert.appendChild(createDom('span', { className: 'exceptions' },
createDom("label", { className: "label", 'for': "raise-exceptions" }, "raise exceptions"), createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'),
createDom("input", { createDom('input', {
className: "raise", className: 'raise',
id: "raise-exceptions", id: 'raise-exceptions',
type: "checkbox" type: 'checkbox'
}) })
)); ));
var checkbox = find("input"); var checkbox = find('input');
checkbox.checked = !env.catchingExceptions(); checkbox.checked = !env.catchingExceptions();
checkbox.onclick = onRaiseExceptionsClick; checkbox.onclick = onRaiseExceptionsClick;
if (specsExecuted < totalSpecsDefined) { if (specsExecuted < totalSpecsDefined) {
var skippedMessage = "Ran " + specsExecuted + " of " + totalSpecsDefined + " specs - run all"; var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
alert.appendChild( alert.appendChild(
createDom("span", {className: "bar skipped"}, createDom('span', {className: 'bar skipped'},
createDom("a", {href: "?", title: "Run all specs"}, skippedMessage) createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
) )
); );
} }
var statusBarMessage = "" + pluralize("spec", specsExecuted) + ", " + pluralize("failure", failureCount); var statusBarMessage = '' + pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
if (pendingSpecCount) { statusBarMessage += ", " + pluralize("pending spec", pendingSpecCount); } if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
var statusBarClassName = "bar " + ((failureCount > 0) ? "failed" : "passed"); 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); results.appendChild(summary);
summaryList(topResults, summary); summaryList(topResults, summary);
@@ -145,27 +145,27 @@ jasmineRequire.HtmlReporter = function(j$) {
var specListNode; var specListNode;
for (var i = 0; i < resultsTree.children.length; i++) { for (var i = 0; i < resultsTree.children.length; i++) {
var resultNode = resultsTree.children[i]; var resultNode = resultsTree.children[i];
if (resultNode.type == "suite") { if (resultNode.type == 'suite') {
var suiteListNode = createDom("ul", {className: "suite", id: "suite-" + resultNode.result.id}, var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
createDom("li", {className: "suite-detail"}, createDom('li', {className: 'suite-detail'},
createDom("a", {href: specHref(resultNode.result)}, resultNode.result.description) createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
) )
); );
summaryList(resultNode, suiteListNode); summaryList(resultNode, suiteListNode);
domParent.appendChild(suiteListNode); domParent.appendChild(suiteListNode);
} }
if (resultNode.type == "spec") { if (resultNode.type == 'spec') {
if (domParent.getAttribute("class") != "specs") { if (domParent.getAttribute('class') != 'specs') {
specListNode = createDom("ul", {className: "specs"}); specListNode = createDom('ul', {className: 'specs'});
domParent.appendChild(specListNode); domParent.appendChild(specListNode);
} }
specListNode.appendChild( specListNode.appendChild(
createDom("li", { createDom('li', {
className: resultNode.result.status, 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)}, resultNode.result.description)
) )
); );
} }
@@ -174,24 +174,24 @@ jasmineRequire.HtmlReporter = function(j$) {
if (failures.length) { if (failures.length) {
alert.appendChild( alert.appendChild(
createDom('span', {className: "menu bar spec-list"}, createDom('span', {className: 'menu bar spec-list'},
createDom("span", {}, "Spec List | "), createDom('span', {}, 'Spec List | '),
createDom('a', {className: "failures-menu", href: "#"}, "Failures"))); createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
alert.appendChild( alert.appendChild(
createDom('span', {className: "menu bar failure-list"}, createDom('span', {className: 'menu bar failure-list'},
createDom('a', {className: "spec-list-menu", href: "#"}, "Spec List"), createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
createDom("span", {}, " | Failures "))); createDom('span', {}, ' | Failures ')));
find(".failures-menu").onclick = function() { find('.failures-menu').onclick = function() {
setMenuModeTo('failure-list'); setMenuModeTo('failure-list');
}; };
find(".spec-list-menu").onclick = function() { find('.spec-list-menu').onclick = function() {
setMenuModeTo('spec-list'); setMenuModeTo('spec-list');
}; };
setMenuModeTo('failure-list'); setMenuModeTo('failure-list');
var failureNode = find(".failures"); var failureNode = find('.failures');
for (var i = 0; i < failures.length; i++) { for (var i = 0; i < failures.length; i++) {
failureNode.appendChild(failures[i]); failureNode.appendChild(failures[i]);
} }
@@ -220,7 +220,7 @@ jasmineRequire.HtmlReporter = function(j$) {
} }
for (var attr in attrs) { for (var attr in attrs) {
if (attr == "className") { if (attr == 'className') {
el[attr] = attrs[attr]; el[attr] = attrs[attr];
} else { } else {
el.setAttribute(attr, attrs[attr]); el.setAttribute(attr, attrs[attr]);
@@ -231,17 +231,17 @@ jasmineRequire.HtmlReporter = function(j$) {
} }
function pluralize(singular, count) { 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) { function specHref(result) {
return "?spec=" + encodeURIComponent(result.fullName); return '?spec=' + encodeURIComponent(result.fullName);
} }
function setMenuModeTo(mode) { function setMenuModeTo(mode) {
htmlReporterMain.setAttribute("class", "html-reporter " + mode); htmlReporterMain.setAttribute('class', 'html-reporter ' + mode);
} }
} }

View File

@@ -1,6 +1,6 @@
jasmineRequire.HtmlSpecFilter = function() { jasmineRequire.HtmlSpecFilter = function() {
function HtmlSpecFilter(options) { 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); var filterPattern = new RegExp(filterString);
this.matches = function(specName) { this.matches = function(specName) {

View File

@@ -16,9 +16,9 @@ jasmineRequire.QueryString = function() {
function toQueryString(paramMap) { function toQueryString(paramMap) {
var qStrPairs = []; var qStrPairs = [];
for (var prop in paramMap) { 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() { function queryStringToParamMap() {
@@ -31,7 +31,7 @@ jasmineRequire.QueryString = function() {
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
var p = params[i].split('='); var p = params[i].split('=');
var value = decodeURIComponent(p[1]); var value = decodeURIComponent(p[1]);
if (value === "true" || value === "false") { if (value === 'true' || value === 'false') {
value = JSON.parse(value); value = JSON.parse(value);
} }
paramMap[decodeURIComponent(p[0])] = value; paramMap[decodeURIComponent(p[0])] = value;

View File

@@ -1,3 +1,3 @@
getJasmineRequireObj().version = function() { getJasmineRequireObj().version = function() {
return "<%= version %>"; return '<%= version %>';
}; };