jshint passes - run 'node jshint/run.js'. running jshint with a couple jshint options and workarounds to allow certain jasmine-specific styles. many actual style problems are fixed. the jshint run is integrated into rake jasmine:lint.

This commit is contained in:
Steve Conover
2011-02-26 15:07:59 -08:00
parent 9f90c4eca5
commit f41af6c2d0
20 changed files with 184 additions and 139 deletions

View File

@@ -108,7 +108,8 @@ jasmine.ExpectationResult.prototype.passed = function () {
* Getter for the Jasmine environment. Ensures one gets created
*/
jasmine.getEnv = function() {
return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
return env;
};
/**
@@ -171,7 +172,7 @@ jasmine.pp = function(value) {
* @returns {Boolean}
*/
jasmine.isDomNode = function(obj) {
return obj['nodeType'] > 0;
return obj.nodeType > 0;
};
/**
@@ -407,7 +408,7 @@ jasmine.isSpy = function(putativeSpy) {
* @param {Array} methodNames array of names of methods to make spies
*/
jasmine.createSpyObj = function(baseName, methodNames) {
if (!jasmine.isArray_(methodNames) || methodNames.length == 0) {
if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
}
var obj = {};
@@ -582,21 +583,20 @@ if (isCommonJS) exports.xdescribe = xdescribe;
// Provide the XMLHttpRequest class for IE 5.x-6.x:
jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
try {
return new ActiveXObject("Msxml2.XMLHTTP.6.0");
} catch(e) {
function tryIt(f) {
try {
return f();
} catch(e) {
}
return null;
}
try {
return new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
}
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
}
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
}
throw new Error("This browser does not support XMLHttpRequest.");
var xhr = tryIt(function(){return new ActiveXObject("Msxml2.XMLHTTP.6.0");}) ||
tryIt(function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0");}) ||
tryIt(function(){return new ActiveXObject("Msxml2.XMLHTTP");}) ||
tryIt(function(){return new ActiveXObject("Microsoft.XMLHTTP");});
if (!xhr) throw new Error("This browser does not support XMLHttpRequest.");
return xhr;
} : XMLHttpRequest;