mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
Fixed all trivial jslint violations
This commit is contained in:
parent
e3f760fbad
commit
894ffadc8c
10 changed files with 33 additions and 37 deletions
|
|
@ -94,7 +94,7 @@ function extend(dst) {
|
|||
|
||||
function inherit(parent, extra) {
|
||||
return extend(new (extend(function(){}, {prototype:parent}))(), extra);
|
||||
};
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
function identity($) {return $;}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function setter(instance, path, value){
|
|||
}
|
||||
|
||||
///////////////////////////////////
|
||||
var scopeId = 0;
|
||||
var scopeId = 0,
|
||||
getterFnCache = {},
|
||||
compileCache = {},
|
||||
JS_KEYWORDS = {};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ angularDirective("ng:bind", function(expression){
|
|||
});
|
||||
this.$element = oldElement;
|
||||
if (lastValue === value && lastError == error) return;
|
||||
isHtml = value instanceof HTML,
|
||||
isHtml = value instanceof HTML;
|
||||
isDomElement = isElement(value);
|
||||
if (!isHtml && !isDomElement && isObject(value)) {
|
||||
value = toJson(value);
|
||||
|
|
@ -85,7 +85,7 @@ function compileBindTemplate(template){
|
|||
else if (isObject(value))
|
||||
value = toJson(value, true);
|
||||
parts.push(value);
|
||||
};
|
||||
}
|
||||
self.$element = oldElement;
|
||||
return parts.join('');
|
||||
};
|
||||
|
|
@ -133,7 +133,7 @@ angularDirective("ng:bind-attr", function(expression){
|
|||
element.attr(key, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}, element);
|
||||
};
|
||||
});
|
||||
|
|
@ -187,7 +187,7 @@ angularWidget("@ng:repeat", function(expression, element){
|
|||
lastElement = childScope.$element;
|
||||
index ++;
|
||||
}
|
||||
};
|
||||
}
|
||||
// shrink children
|
||||
while(children.length > index) {
|
||||
children.pop().$element.remove();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ angular.scenario.dsl.browser = {
|
|||
href: "",
|
||||
hash: "",
|
||||
toEqual: function(url) {
|
||||
return (this.hash == "" ? (url == this.href) :
|
||||
return (this.hash === "" ? (url == this.href) :
|
||||
(url == (this.href + "/#/" + this.hash)));
|
||||
},
|
||||
setLocation: function(url) {
|
||||
|
|
@ -56,7 +56,7 @@ angular.scenario.dsl.input = function(selector) {
|
|||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
angular.scenario.dsl.NG_BIND_PATTERN =/\{\{[^\}]+\}\}/;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ angular.scenario.Runner.prototype = {
|
|||
} else {
|
||||
self.scope.$testrun.done = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
callback();
|
||||
},
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ angular.scenario.Runner.prototype = {
|
|||
steps: futuresFulfilled});
|
||||
done();
|
||||
}
|
||||
};
|
||||
}
|
||||
next();
|
||||
return specThis;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ angularService('$exceptionHandler', function($log){
|
|||
}, {inject:['$log']});
|
||||
|
||||
angularService("$hover", function(browser, document) {
|
||||
var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body);;
|
||||
var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body);
|
||||
browser.hover(function(element, show){
|
||||
if (show && (error = element.attr(NG_EXCEPTION) || element.attr(NG_VALIDATION_ERROR))) {
|
||||
if (!tooltip) {
|
||||
|
|
@ -345,7 +345,7 @@ angularService('$xhr.bulk', function($xhr, $error, $log){
|
|||
}, {inject:['$xhr', '$xhr.error', '$log']});
|
||||
|
||||
angularService('$xhr.cache', function($xhr){
|
||||
var inflight = {}, self = this;;
|
||||
var inflight = {}, self = this;
|
||||
function cache(method, url, post, callback, verifyCache){
|
||||
if (isFunction(post)) {
|
||||
callback = post;
|
||||
|
|
@ -418,7 +418,7 @@ angularService('$cookies', function($browser) {
|
|||
//delete cookies[name];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}, {inject: ['$browser']});
|
||||
|
||||
|
||||
|
|
@ -455,4 +455,4 @@ angularService('$sessionStore', function($store) {
|
|||
|
||||
return new SessionStore();
|
||||
|
||||
}, {inject: ['$cookies']});
|
||||
}, {inject: ['$cookies']});
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ describe('browser', function(){
|
|||
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
|
||||
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var browser;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,33 +43,29 @@ describe("DSL", function() {
|
|||
|
||||
describe('browser', function() {
|
||||
var browser = angular.scenario.dsl.browser;
|
||||
it('shoud return true if location with empty hash provided is same '
|
||||
+ 'as location of the page', function() {
|
||||
it('shoud return true if location with empty hash provided is same ' +
|
||||
'as location of the page', function() {
|
||||
browser.location.href = "http://server";
|
||||
expect(browser.location.toEqual("http://server")).toEqual(true);
|
||||
});
|
||||
it('shoud return true if location with hash provided is same '
|
||||
+ 'as location of the page', function() {
|
||||
it('shoud return true if location with hash provided is same ' +
|
||||
'as location of the page', function() {
|
||||
browser.location.href = "http://server";
|
||||
browser.location.hash = "hashPath";
|
||||
expect(browser.location.toEqual("http://server/#/hashPath"))
|
||||
.toEqual(true);
|
||||
expect(browser.location.toEqual("http://server/#/hashPath")).toEqual(true);
|
||||
});
|
||||
it('should return true if the location provided is the same as which '
|
||||
+ 'browser navigated to', function() {
|
||||
it('should return true if the location provided is the same as which ' +
|
||||
'browser navigated to', function() {
|
||||
var future = browser.navigateTo("http://server/#/hashPath");
|
||||
expect(future.name).toEqual("Navigate to: http://server/#/hashPath");
|
||||
executeFuture(future, '<input type="text" name="name" />');
|
||||
expect(browser.location.toEqual("http://server/#/hashPath"))
|
||||
.toEqual(true);
|
||||
expect(browser.location.toEqual("http://server/"))
|
||||
.toEqual(false);
|
||||
expect(browser.location.toEqual("http://server/#/hashPath")).toEqual(true);
|
||||
expect(browser.location.toEqual("http://server/")).toEqual(false);
|
||||
|
||||
future = browser.navigateTo("http://server/");
|
||||
expect(future.name).toEqual("Navigate to: http://server/");
|
||||
executeFuture(future, '<input type="text" name="name" />');
|
||||
expect(browser.location.toEqual("http://server/"))
|
||||
.toEqual(true);
|
||||
expect(browser.location.toEqual("http://server/")).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ describe('Runner', function() {
|
|||
fail();
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual('blah');
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ describe('Runner', function() {
|
|||
|
||||
describe('future building', function() {
|
||||
it('should queue futures', function() {
|
||||
function behavior(){};
|
||||
function behavior(){}
|
||||
Describe('name', function() {
|
||||
It('should', function() {
|
||||
$scenario.addFuture('futureName', behavior);
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ describe("service", function(){
|
|||
describe("$log", function(){
|
||||
it('should use console if present', function(){
|
||||
var logger = "";
|
||||
function log(){ logger+= 'log;'; };
|
||||
function warn(){ logger+= 'warn;'; };
|
||||
function info(){ logger+= 'info;'; };
|
||||
function error(){ logger+= 'error;'; };
|
||||
function log(){ logger+= 'log;'; }
|
||||
function warn(){ logger+= 'warn;'; }
|
||||
function info(){ logger+= 'info;'; }
|
||||
function error(){ logger+= 'error;'; }
|
||||
var scope = createScope(null, angularService, {$window: {console:{log:log, warn:warn, info:info, error:error}}, $document:[{cookie:''}]});
|
||||
scope.$log.log();
|
||||
scope.$log.warn();
|
||||
|
|
@ -48,7 +48,7 @@ describe("service", function(){
|
|||
|
||||
it('should use console.log if other not present', function(){
|
||||
var logger = "";
|
||||
function log(){ logger+= 'log;'; };
|
||||
function log(){ logger+= 'log;'; }
|
||||
var scope = createScope(null, angularService, {$window: {console:{log:log}}, $document:[{cookie:''}]});
|
||||
scope.$log.log();
|
||||
scope.$log.warn();
|
||||
|
|
@ -462,4 +462,4 @@ describe("service", function(){
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue