diff --git a/Gruntfile.js b/Gruntfile.js
index 95c5167dbde2..170f494afc6d 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -107,6 +107,9 @@ module.exports = function(grunt) {
options: {
jshintrc: true,
},
+ tests: {
+ files: { src: 'test/**/*.js' },
+ },
ng: {
files: { src: files['angularSrc'] },
},
diff --git a/test/.jshintrc b/test/.jshintrc
index f369426120d1..fe91f7f29e2b 100644
--- a/test/.jshintrc
+++ b/test/.jshintrc
@@ -16,6 +16,7 @@
"sub": true,
"undef": true,
"browser": true,
+ "indent": 2,
"globals": {
/* auto/injector.js */
"createInjector": false,
@@ -42,7 +43,6 @@
"isArrayLike": false,
"forEach": false,
"sortedKeys": false,
- "forEachSorted": false,
"reverseParams": false,
"nextUid": false,
"setHashKey": false,
@@ -102,9 +102,6 @@
"getter": false,
"getBlockElements": false,
- /* filters.js */
- "getFirstThursdayOfYear": false,
-
/* AngularPublic.js */
"version": false,
"publishExternalAPI": false,
@@ -147,24 +144,6 @@
"urlResolve": false,
"urlIsSameOrigin": false,
- /* ng/compile.js */
- "directiveNormalize": false,
-
- /* ng/parse.js */
- "setter": false,
-
- /* ng/directive/directives.js */
- "ngDirective": false,
-
- /* ng/directive/input.js */
- "VALID_CLASS": false,
- "INVALID_CLASS": false,
- "PRISTINE_CLASS": false,
- "DIRTY_CLASS": false,
-
- /* ng/directive/form.js */
- "nullFormCtrl": false,
-
/* jasmine / karma */
"it": false,
"iit": false,
@@ -175,10 +154,29 @@
"expect": false,
"jasmine": false,
"spyOn": false,
+ "waits": false,
+ "waitsFor": false,
+ "runs": false,
+ "dump": false,
+
+ /* e2e */
+ "browser": false,
+ "element": false,
+ "by": false,
/* testabilityPatch / matchers */
"inject": false,
"module": false,
- "dealoc": false
+ "dealoc": false,
+ "_jQuery": false,
+ "_jqLiteMode": false,
+ "sortedHtml": false,
+ "childrenTagsOf": false,
+ "assertHidden": false,
+ "assertVisible": false,
+ "provideLog": false,
+ "spyOnlyCallsWithArgs": false,
+ "createMockStyleSheet": false,
+ "browserTrigger": false
}
}
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index f1b0b7203abb..12142a918fc1 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -118,7 +118,7 @@ describe('angular', function() {
it('should throw an exception when source and destination are equivalent', function() {
var src, dst;
- src = dst = {key: 'value'};
+ src = dst = {key: 'value'};
expect(function() { copy(src, dst); }).toThrowMinErr("ng", "cpi", "Can't copy! Source and destination are identical.");
src = dst = [2, 4];
expect(function() { copy(src, dst); }).toThrowMinErr("ng", "cpi", "Can't copy! Source and destination are identical.");
@@ -149,7 +149,6 @@ describe('angular', function() {
});
describe("extend", function() {
-
it('should not copy the private $$hashKey', function() {
var src,dst;
src = {};
@@ -209,7 +208,7 @@ describe('angular', function() {
it('should omit properties from prototype chain', function() {
var original, clone = {};
- function Func() {};
+ function Func() {}
Func.prototype.hello = "world";
original = new Func();
@@ -316,6 +315,7 @@ describe('angular', function() {
});
it('should correctly test for keys that are present on Object.prototype', function() {
+ /* jshint -W001 */
// MS IE8 just doesn't work for this kind of thing, since "for ... in" doesn't return
// things like hasOwnProperty even if it is explicitly defined on the actual object!
if (msie<=8) return;
@@ -457,7 +457,7 @@ describe('angular', function() {
expect(toKeyValue({key: [323,'value',true]})).toEqual('key=323&key=value&key');
expect(toKeyValue({key: [323,'value',true, 1234]})).
toEqual('key=323&key=value&key&key=1234');
- });
+ });
});
@@ -472,13 +472,14 @@ describe('angular', function() {
var obj = new MyObj(),
log = [];
- forEach(obj, function(value, key) { log.push(key + ':' + value)});
+ forEach(obj, function(value, key) { log.push(key + ':' + value); });
expect(log).toEqual(['bar:barVal', 'baz:bazVal']);
});
it('should not break if obj is an array we override hasOwnProperty', function() {
+ /* jshint -W001 */
var obj = [];
obj[0] = 1;
obj[1] = 2;
@@ -506,7 +507,7 @@ describe('angular', function() {
log = [];
- forEach(nodeList, function(value, key) { log.push(key + ':' + value.innerHTML)});
+ forEach(nodeList, function(value, key) { log.push(key + ':' + value.innerHTML); });
expect(log).toEqual(['0:a', '1:b', '2:c']);
});
@@ -521,7 +522,7 @@ describe('angular', function() {
var htmlCollection = document.getElementsByName('x'),
log = [];
- forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML)});
+ forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML); });
expect(log).toEqual(['0:a', '1:c']);
});
@@ -536,7 +537,7 @@ describe('angular', function() {
var htmlCollection = document.querySelectorAll('[name="x"]'),
log = [];
- forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML)});
+ forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML); });
expect(log).toEqual(['0:a', '1:c']);
});
}
@@ -545,28 +546,28 @@ describe('angular', function() {
var args,
log = [];
- (function(){ args = arguments}('a', 'b', 'c'));
+ (function(){ args = arguments; }('a', 'b', 'c'));
- forEach(args, function(value, key) { log.push(key + ':' + value)});
+ forEach(args, function(value, key) { log.push(key + ':' + value); });
expect(log).toEqual(['0:a', '1:b', '2:c']);
});
it('should handle string values like arrays', function() {
var log = [];
- forEach('bar', function(value, key) { log.push(key + ':' + value)});
+ forEach('bar', function(value, key) { log.push(key + ':' + value); });
expect(log).toEqual(['0:b', '1:a', '2:r']);
});
it('should handle objects with length property as objects', function() {
var obj = {
- 'foo' : 'bar',
- 'length': 2
- },
- log = [];
+ 'foo' : 'bar',
+ 'length': 2
+ },
+ log = [];
- forEach(obj, function(value, key) { log.push(key + ':' + value)});
+ forEach(obj, function(value, key) { log.push(key + ':' + value); });
expect(log).toEqual(['foo:bar', 'length:2']);
});
@@ -574,13 +575,13 @@ describe('angular', function() {
it('should handle objects of custom types with length property as objects', function() {
function CustomType() {
this.length = 2;
- this.foo = 'bar'
+ this.foo = 'bar';
}
var obj = new CustomType(),
log = [];
- forEach(obj, function(value, key) { log.push(key + ':' + value)});
+ forEach(obj, function(value, key) { log.push(key + ':' + value); });
expect(log).toEqual(['length:2', 'foo:bar']);
});
});
@@ -748,9 +749,11 @@ describe('angular', function() {
var appElement = jqLite('
')[0];
expect(function() {
- angularInit(appElement, bootstrap);
+ angularInit(appElement, angular.bootstrap);
}).toThrowMatching(
- /\[\$injector:modulerr] Failed to instantiate module doesntexist due to:\n.*\[\$injector:nomod] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it\./
+ new RegExp('\\[\\$injector:modulerr] Failed to instantiate module doesntexist due to:\\n' +
+ '.*\\[\\$injector:nomod] Module \'doesntexist\' is not available! You either ' +
+ 'misspelled the module name or forgot to load it\\.')
);
});
@@ -789,7 +792,7 @@ describe('angular', function() {
expect(bootstrapSpy.mostRecentCall.args[2].strictDi).toBe(true);
var injector = appElement.injector();
- function testFactory($rootScope) {};
+ function testFactory($rootScope) {}
expect(function() {
injector.instantiate(testFactory);
}).toThrowMinErr('$injector', 'strictdi');
@@ -956,7 +959,9 @@ describe('angular', function() {
expect(function() {
angular.bootstrap(element, ['doesntexist']);
}).toThrowMatching(
- /\[\$injector:modulerr\] Failed to instantiate module doesntexist due to:\n.*\[\$injector:nomod\] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it\./);
+ new RegExp('\\[\\$injector:modulerr\\] Failed to instantiate module doesntexist due to:\\n' +
+ '.*\\[\\$injector:nomod\\] Module \'doesntexist\' is not available! You either ' +
+ 'misspelled the module name or forgot to load it\\.'));
expect(element.html()).toBe('{{1+2}}');
dealoc(element);
diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js
index 22686b98b0c3..eecde9bf33b4 100644
--- a/test/auto/injectorSpec.js
+++ b/test/auto/injectorSpec.js
@@ -110,6 +110,7 @@ describe('injector', function() {
function fn(a, b, c, d) {
+ /* jshint -W040 */
args = [this, a, b, c, d];
return a + b + c + d;
}
@@ -147,6 +148,7 @@ describe('injector', function() {
describe('annotation', function() {
+ /* global annotate: false */
it('should return $inject', function() {
function fn() {}
fn.$inject = ['a'];
@@ -159,6 +161,7 @@ describe('injector', function() {
it('should create $inject', function() {
+ var extraParans = angular.noop;
// keep the multi-line to make sure we can handle it
function $f_n0 /*
*/(
@@ -175,7 +178,7 @@ describe('injector', function() {
it('should strip leading and trailing underscores from arg name during inference', function() {
- function beforeEachFn(_foo_) { /* foo = _foo_ */ };
+ function beforeEachFn(_foo_) { /* foo = _foo_ */ }
expect(annotate(beforeEachFn)).toEqual(['foo']);
});
@@ -240,9 +243,9 @@ describe('injector', function() {
describe('module', function() {
it('should provide $injector even when no module is requested', function() {
var $provide,
- $injector = createInjector([
- angular.extend(function(p) { $provide = p; }, {$inject: ['$provide']})
- ]);
+ $injector = createInjector([
+ angular.extend(function(p) { $provide = p; }, {$inject: ['$provide']})
+ ]);
expect($injector.get('$injector')).toBe($injector);
});
@@ -298,9 +301,9 @@ describe('injector', function() {
angular.module('a', [], function(){ log += 'a'; }).run(function() { log += 'A'; });
angular.module('b', ['a'], function(){ log += 'b'; }).run(function() { log += 'B'; });
createInjector([
- 'b',
- valueFn(function() { log += 'C'; }),
- [valueFn(function() { log += 'D'; })]
+ 'b',
+ valueFn(function() { log += 'C'; }),
+ [valueFn(function() { log += 'D'; })]
]);
expect(log).toEqual('abABCD');
});
@@ -328,19 +331,19 @@ describe('injector', function() {
it('should create configuration injectable constants', function() {
var log = [];
createInjector([
- function($provide){
- $provide.constant('abc', 123);
- $provide.constant({a: 'A', b:'B'});
- return function(a) {
- log.push(a);
- }
- },
- function(abc) {
- log.push(abc);
- return function(b) {
- log.push(b);
- }
- }
+ function($provide){
+ $provide.constant('abc', 123);
+ $provide.constant({a: 'A', b:'B'});
+ return function(a) {
+ log.push(a);
+ };
+ },
+ function(abc) {
+ log.push(abc);
+ return function(b) {
+ log.push(b);
+ };
+ }
]).get('abc');
expect(log).toEqual([123, 'A', 'B']);
});
@@ -422,7 +425,7 @@ describe('injector', function() {
it('should configure $provide provider type', function() {
- function Type() {};
+ function Type() {}
Type.prototype.$get = function() {
expect(this instanceof Type).toBe(true);
return 'abc';
@@ -436,7 +439,7 @@ describe('injector', function() {
it('should configure $provide using an array', function() {
function Type(PREFIX) {
this.prefix = PREFIX;
- };
+ }
Type.prototype.$get = function() {
return this.prefix + 'def';
};
@@ -527,7 +530,7 @@ describe('injector', function() {
return function(val) {
log.push('myService:' + val + ',' + dep1);
return 'origReturn';
- }
+ };
}]);
$provide.decorator('myService', function($delegate) {
@@ -554,7 +557,7 @@ describe('injector', function() {
return function(val) {
log.push('myService:' + val);
return 'origReturn';
- }
+ };
});
$provide.decorator('myService', function($delegate, dep1) {
@@ -704,7 +707,8 @@ describe('injector', function() {
})).toEqual('melville:moby');
expect($injector.invoke(function(book, author) {
expect(this).toEqual($injector);
- return author + ':' + book;}, $injector)).toEqual('melville:moby');
+ return author + ':' + book;
+ }, $injector)).toEqual('melville:moby');
});
@@ -722,7 +726,7 @@ describe('injector', function() {
it('should invoke method which is annotated', function() {
expect($injector.invoke(extend(function(b, a) {
- return a + ':' + b
+ return a + ':' + b;
}, {$inject:['book', 'author']}))).toEqual('melville:moby');
expect($injector.invoke(extend(function(b, a) {
expect(this).toEqual($injector);
@@ -855,10 +859,10 @@ describe('injector', function() {
it('should prevent instance lookup in module', function() {
- function instanceLookupInModule(name) { throw Error('FAIL'); }
+ function instanceLookupInModule(name) { throw new Error('FAIL'); }
expect(function() {
createInjector([function($provide) {
- $provide.value('name', 'angular')
+ $provide.value('name', 'angular');
}, instanceLookupInModule]);
}).toThrowMatching(/\[\$injector:unpr] Unknown provider: name/);
});
@@ -920,7 +924,7 @@ describe('strict-di injector', function() {
it('should throw if magic annotation is used by factory', function() {
module(function($provide) {
$provide.factory({
- '$test': function($rootScope) { return function() {} },
+ '$test': function($rootScope) { return function() {}; },
});
});
inject(function($injector) {
diff --git a/test/e2e/docsAppE2E.js b/test/e2e/docsAppE2E.js
index 8fe30c38b219..b3fe257ee340 100644
--- a/test/e2e/docsAppE2E.js
+++ b/test/e2e/docsAppE2E.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('docs.angularjs.org', function () {
describe('App', function () {
// it('should filter the module list when searching', function () {
@@ -66,4 +68,4 @@ describe('docs.angularjs.org', function () {
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
});
});
-});
\ No newline at end of file
+});
diff --git a/test/helpers/matchers.js b/test/helpers/matchers.js
index c5d7d6cfd3c6..b18604bf9ba4 100644
--- a/test/helpers/matchers.js
+++ b/test/helpers/matchers.js
@@ -1,3 +1,5 @@
+'use strict';
+
beforeEach(function() {
function cssMatcher(presentClasses, absentClasses) {
@@ -39,7 +41,7 @@ beforeEach(function() {
}
});
return hidden;
- };
+ }
this.addMatchers({
toBeInvalid: cssMatcher('ng-invalid', 'ng-valid'),
@@ -128,7 +130,7 @@ beforeEach(function() {
this.message = function() {
if (this.actual.callCount != 1) {
- if (this.actual.callCount == 0) {
+ if (this.actual.callCount === 0) {
return [
'Expected spy ' + this.actual.identity + ' to have been called once with ' +
jasmine.pp(expectedArgs) + ' but it was never called.',
diff --git a/test/helpers/privateMocks.js b/test/helpers/privateMocks.js
index 6d9fb34fc474..0e54f8e9d769 100644
--- a/test/helpers/privateMocks.js
+++ b/test/helpers/privateMocks.js
@@ -1,3 +1,5 @@
+'use strict';
+
function createMockStyleSheet(doc, wind) {
doc = doc ? doc[0] : document;
wind = wind || window;
@@ -17,7 +19,7 @@ function createMockStyleSheet(doc, wind) {
try {
ss.addRule(selector, styles);
}
- catch(e) {}
+ catch(e2) {}
}
},
@@ -25,4 +27,4 @@ function createMockStyleSheet(doc, wind) {
head.removeChild(node);
}
};
-};
+}
diff --git a/test/helpers/privateMocksSpec.js b/test/helpers/privateMocksSpec.js
index d5a1e188ea57..6d86ecb81c2a 100644
--- a/test/helpers/privateMocksSpec.js
+++ b/test/helpers/privateMocksSpec.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('private mocks', function() {
describe('createMockStyleSheet', function() {
@@ -29,7 +31,7 @@ describe('private mocks', function() {
return node.currentStyle ?
node.currentStyle[key] :
$window.getComputedStyle(node)[key];
- };
+ }
}));
});
diff --git a/test/helpers/testabilityPatch.js b/test/helpers/testabilityPatch.js
index 34b6b78a0141..658d1883c102 100644
--- a/test/helpers/testabilityPatch.js
+++ b/test/helpers/testabilityPatch.js
@@ -1,3 +1,4 @@
+/* global jQuery: true, uid: true */
'use strict';
/**
@@ -150,7 +151,7 @@ function sortedHtml(element, showNgClass) {
var attr = attributes[i];
if(attr.name.match(/^ng[\:\-]/) ||
- (attr.value || attr.value == '') &&
+ (attr.value || attr.value === '') &&
attr.value !='null' &&
attr.value !='auto' &&
attr.value !='false' &&
@@ -283,7 +284,7 @@ function provideLog($provide) {
var currentMessages = messages;
messages = [];
return currentMessages;
- }
+ };
log.fn = function(msg) {
return function() {
@@ -299,7 +300,7 @@ function provideLog($provide) {
function pending() {
dump('PENDING');
-};
+}
function trace(name) {
dump(new Error(name).stack);
diff --git a/test/jQueryPatchSpec.js b/test/jQueryPatchSpec.js
index c42bbb708c20..10e46be8a499 100644
--- a/test/jQueryPatchSpec.js
+++ b/test/jQueryPatchSpec.js
@@ -1,3 +1,4 @@
+/* global $: false */
'use strict';
if (window.jQuery) {
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js
index f9c6f3a2b55f..8bab591ae173 100644
--- a/test/jqLiteSpec.js
+++ b/test/jqLiteSpec.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('jqLite', function() {
var scope, a, b, c;
@@ -57,7 +59,7 @@ describe('jqLite', function() {
it('should allow construction with html', function() {
var nodes = jqLite('1
2 ');
expect(nodes[0].parentNode).toBeDefined();
- expect(nodes[0].parentNode.nodeType).toBe(11); /** Document Fragment **/;
+ expect(nodes[0].parentNode.nodeType).toBe(11); /** Document Fragment **/
expect(nodes[0].parentNode).toBe(nodes[1].parentNode);
expect(nodes.length).toEqual(2);
expect(nodes[0].innerHTML).toEqual('1');
@@ -68,7 +70,7 @@ describe('jqLite', function() {
it('should allow construction of html with leading whitespace', function() {
var nodes = jqLite(' \n\r \r\n1
2 ');
expect(nodes[0].parentNode).toBeDefined();
- expect(nodes[0].parentNode.nodeType).toBe(11); /** Document Fragment **/;
+ expect(nodes[0].parentNode.nodeType).toBe(11); /** Document Fragment **/
expect(nodes[0].parentNode).toBe(nodes[1].parentNode);
expect(nodes.length).toBe(2);
expect(nodes[0].innerHTML).toBe('1');
@@ -473,7 +475,7 @@ describe('jqLite', function() {
span = div.find('span'),
log = '';
- span.on('click', function() { log+= 'click;'});
+ span.on('click', function() { log += 'click;'; });
browserTrigger(span);
expect(log).toEqual('click;');
@@ -945,21 +947,21 @@ describe('jqLite', function() {
if (jqLite.fn) return; // don't run in jQuery
var eventFn;
var window = {
- document: {},
- location: {},
- alert: noop,
- setInterval: noop,
- length:10, // pretend you are an array
- addEventListener: function(type, fn){
- expect(type).toEqual('hashchange');
- eventFn = fn;
- },
- removeEventListener: noop,
- attachEvent: function(type, fn){
- expect(type).toEqual('onhashchange');
- eventFn = fn;
- },
- detachEvent: noop
+ document: {},
+ location: {},
+ alert: noop,
+ setInterval: noop,
+ length:10, // pretend you are an array
+ addEventListener: function(type, fn){
+ expect(type).toEqual('hashchange');
+ eventFn = fn;
+ },
+ removeEventListener: noop,
+ attachEvent: function(type, fn){
+ expect(type).toEqual('onhashchange');
+ eventFn = fn;
+ },
+ detachEvent: noop
};
var log;
var jWindow = jqLite(window).on('hashchange', function() {
@@ -1046,16 +1048,17 @@ describe('jqLite', function() {
if (window.jQuery) return;
var browserMoveTrigger = function(from, to){
var fireEvent = function(type, element, relatedTarget){
- var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]);
+ var evnt, msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]);
if (msie < 9){
- var evnt = document.createEventObject();
+ evnt = document.createEventObject();
evnt.srcElement = element;
evnt.relatedTarget = relatedTarget;
element.fireEvent('on' + type, evnt);
return;
- };
- var evnt = document.createEvent('MouseEvents'),
- originalPreventDefault = evnt.preventDefault,
+ }
+ evnt = document.createEvent('MouseEvents');
+
+ var originalPreventDefault = evnt.preventDefault,
appWindow = window,
fakeProcessDefault = true,
finalProcessDefault;
@@ -1656,26 +1659,25 @@ describe('jqLite', function() {
describe('camelCase', function() {
-
- it('should leave non-dashed strings alone', function() {
- expect(camelCase('foo')).toBe('foo');
- expect(camelCase('')).toBe('');
- expect(camelCase('fooBar')).toBe('fooBar');
- });
+ it('should leave non-dashed strings alone', function() {
+ expect(camelCase('foo')).toBe('foo');
+ expect(camelCase('')).toBe('');
+ expect(camelCase('fooBar')).toBe('fooBar');
+ });
- it('should covert dash-separated strings to camelCase', function() {
- expect(camelCase('foo-bar')).toBe('fooBar');
- expect(camelCase('foo-bar-baz')).toBe('fooBarBaz');
- expect(camelCase('foo:bar_baz')).toBe('fooBarBaz');
- });
+ it('should covert dash-separated strings to camelCase', function() {
+ expect(camelCase('foo-bar')).toBe('fooBar');
+ expect(camelCase('foo-bar-baz')).toBe('fooBarBaz');
+ expect(camelCase('foo:bar_baz')).toBe('fooBarBaz');
+ });
- it('should covert browser specific css properties', function() {
- expect(camelCase('-moz-foo-bar')).toBe('MozFooBar');
- expect(camelCase('-webkit-foo-bar')).toBe('webkitFooBar');
- expect(camelCase('-webkit-foo-bar')).toBe('webkitFooBar');
- });
+ it('should covert browser specific css properties', function() {
+ expect(camelCase('-moz-foo-bar')).toBe('MozFooBar');
+ expect(camelCase('-webkit-foo-bar')).toBe('webkitFooBar');
+ expect(camelCase('-webkit-foo-bar')).toBe('webkitFooBar');
+ });
});
});
diff --git a/test/jquery_alias.js b/test/jquery_alias.js
index ee4094f24b85..d43920d7431b 100644
--- a/test/jquery_alias.js
+++ b/test/jquery_alias.js
@@ -1,3 +1,4 @@
+/* global _jQuery: true, _jqLiteMode: true */
'use strict';
var _jQuery = jQuery,
diff --git a/test/jquery_remove.js b/test/jquery_remove.js
index 66029c81f50a..c1b41a09fd0c 100644
--- a/test/jquery_remove.js
+++ b/test/jquery_remove.js
@@ -1,3 +1,4 @@
+/* global _jQuery: true, _jqLiteMode: true */
'use strict';
var _jQuery = jQuery.noConflict(true),
diff --git a/test/loaderSpec.js b/test/loaderSpec.js
index 816e0a10603c..e17f329f32e5 100644
--- a/test/loaderSpec.js
+++ b/test/loaderSpec.js
@@ -81,5 +81,5 @@ describe('module loader', function() {
it('should expose `$$minErr` on the `angular` object', function() {
expect(window.angular.$$minErr).toEqual(jasmine.any(Function));
- })
+ });
});
diff --git a/test/ng/anchorScrollSpec.js b/test/ng/anchorScrollSpec.js
index ba64d1a5363c..e7933d630195 100644
--- a/test/ng/anchorScrollSpec.js
+++ b/test/ng/anchorScrollSpec.js
@@ -1,3 +1,4 @@
+'use strict';
describe('$anchorScroll', function() {
var elmSpy;
diff --git a/test/ng/animateSpec.js b/test/ng/animateSpec.js
index b9dd1493330e..30e4273b12cf 100644
--- a/test/ng/animateSpec.js
+++ b/test/ng/animateSpec.js
@@ -1,6 +1,10 @@
+'use strict';
+
describe("$animate", function() {
describe("without animation", function() {
+ var element, $rootElement;
+
beforeEach(module(function() {
return function($compile, _$rootElement_, $rootScope) {
element = $compile('
')($rootScope);
diff --git a/test/ng/browserSpecs.js b/test/ng/browserSpecs.js
index 4157ecbdb7fd..dae55594cda4 100755
--- a/test/ng/browserSpecs.js
+++ b/test/ng/browserSpecs.js
@@ -18,7 +18,7 @@ function MockWindow() {
};
this.addEventListener = function(name, listener) {
- if (isUndefined(events[name])) events[name] = [];
+ if (angular.isUndefined(events[name])) events[name] = [];
events[name].push(listener);
};
@@ -49,7 +49,7 @@ function MockWindow() {
function MockDocument() {
var self = this;
- this[0] = window.document
+ this[0] = window.document;
this.basePath = '/';
this.find = function(name) {
@@ -62,15 +62,15 @@ function MockDocument() {
throw new Error(name);
}
}
- }
+ };
} else {
throw new Error(name);
}
- }
+ };
}
describe('browser', function() {
-
+ /* global Browser: false */
var browser, fakeWindow, fakeDocument, logs, scripts, removedScripts, sniffer;
beforeEach(function() {
diff --git a/test/ng/cacheFactorySpec.js b/test/ng/cacheFactorySpec.js
index b1a018dab879..c0d3c4808d9c 100644
--- a/test/ng/cacheFactorySpec.js
+++ b/test/ng/cacheFactorySpec.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('$cacheFactory', function() {
it('should be injected', inject(function($cacheFactory) {
@@ -176,7 +178,7 @@ describe('$cacheFactory', function() {
describe('LRU cache', function() {
it('should create cache with defined capacity', inject(function($cacheFactory) {
- cache = $cacheFactory('cache1', {capacity: 5});
+ var cache = $cacheFactory('cache1', {capacity: 5});
expect(cache.info().size).toBe(0);
for (var i=0; i<5; i++) {
@@ -193,6 +195,7 @@ describe('$cacheFactory', function() {
describe('eviction', function() {
+ var cache;
beforeEach(inject(function($cacheFactory) {
cache = $cacheFactory('cache1', {capacity: 2});
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 4e6d85c7dc1d..41bf4854b46d 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -82,13 +82,13 @@ describe('$compile', function() {
element.text('SUCCESS');
}
};
- })
+ });
});
inject(function($compile, $rootScope, log) {
element = $compile('
')($rootScope);
expect(element.text()).toEqual('SUCCESS');
expect(log).toEqual('OK');
- })
+ });
});
it('should allow registration of multiple directives with same name', function() {
@@ -282,7 +282,7 @@ describe('$compile', function() {
expect(attr).toBe(templateAttr);
expect(scope).toEqual($rootScope);
element.text('worked');
- }
+ };
}
};
});
@@ -331,8 +331,7 @@ describe('$compile', function() {
parts.sort();
parts.unshift(elementName);
forEach(parts, function(value, key){
- if (value.substring(0,3) == 'ng-') {
- } else {
+ if (value.substring(0,3) !== 'ng-') {
value = value.replace('=""', '');
var match = value.match(/=(.*)/);
if (match && match[1].charAt(0) != '"') {
@@ -398,7 +397,7 @@ describe('$compile', function() {
expect(element.children().length).toBe(1);
expect(element.text()).toBe('Hello');
});
- })
+ });
});
describe('compiler control', function() {
@@ -437,46 +436,46 @@ describe('$compile', function() {
describe('restrict', function() {
it('should allow restriction of attributes', function() {
- module(function() {
- forEach({div:'E', attr:'A', clazz:'C', all:'EAC'}, function(restrict, name) {
- directive(name, function(log) {
- return {
- restrict: restrict,
- compile: valueFn(function(scope, element, attr) {
- log(name);
- })
- };
- });
+ module(function() {
+ forEach({div:'E', attr:'A', clazz:'C', all:'EAC'}, function(restrict, name) {
+ directive(name, function(log) {
+ return {
+ restrict: restrict,
+ compile: valueFn(function(scope, element, attr) {
+ log(name);
+ })
+ };
});
});
- inject(function($rootScope, $compile, log) {
- dealoc($compile(' ')($rootScope));
- expect(log).toEqual('');
- log.reset();
+ });
+ inject(function($rootScope, $compile, log) {
+ dealoc($compile(' ')($rootScope));
+ expect(log).toEqual('');
+ log.reset();
- dealoc($compile('
')($rootScope));
- expect(log).toEqual('div');
- log.reset();
+ dealoc($compile('
')($rootScope));
+ expect(log).toEqual('div');
+ log.reset();
- dealoc($compile(' ')($rootScope));
- expect(log).toEqual('');
- log.reset();
+ dealoc($compile(' ')($rootScope));
+ expect(log).toEqual('');
+ log.reset();
- dealoc($compile(' ')($rootScope));
- expect(log).toEqual('attr');
- log.reset();
+ dealoc($compile(' ')($rootScope));
+ expect(log).toEqual('attr');
+ log.reset();
- dealoc($compile(' ')($rootScope));
- expect(log).toEqual('');
- log.reset();
+ dealoc($compile(' ')($rootScope));
+ expect(log).toEqual('');
+ log.reset();
- dealoc($compile(' ')($rootScope));
- expect(log).toEqual('clazz');
- log.reset();
+ dealoc($compile(' ')($rootScope));
+ expect(log).toEqual('clazz');
+ log.reset();
- dealoc($compile(' ')($rootScope));
- expect(log).toEqual('all; all; all');
- });
+ dealoc($compile(' ')($rootScope));
+ expect(log).toEqual('all; all; all');
+ });
});
});
@@ -640,7 +639,8 @@ describe('$compile', function() {
element = $compile('
')($rootScope);
$rootScope.$digest();
expect(element.css('width')).toBe('2px');
- }));
+ }
+ ));
}
it('should merge interpolated css class', inject(function($compile, $rootScope) {
@@ -681,19 +681,19 @@ describe('$compile', function() {
return {
replace: true,
template: 'dada'
- }
+ };
});
directive('multiRootElem', function() {
return {
replace: true,
template: '
'
- }
+ };
});
directive('singleRootWithWhiteSpace', function() {
return {
replace: true,
template: '
\n'
- }
+ };
});
});
@@ -802,32 +802,38 @@ describe('$compile', function() {
beforeEach(module(
function() {
directive('hello', valueFn({
- restrict: 'CAM', templateUrl: 'hello.html', transclude: true
+ restrict: 'CAM',
+ templateUrl: 'hello.html',
+ transclude: true
}));
directive('cau', valueFn({
- restrict: 'CAM', templateUrl: 'cau.html'
+ restrict: 'CAM',
+ templateUrl: 'cau.html'
}));
directive('crossDomainTemplate', valueFn({
- restrict: 'CAM', templateUrl: 'http://example.com/should-not-load.html'
- }));
- directive('trustedTemplate', function($sce) { return {
restrict: 'CAM',
- templateUrl: function() {
- return $sce.trustAsResourceUrl('http://example.com/trusted-template.html');
- }};
+ templateUrl: 'http://example.com/should-not-load.html'
+ }));
+ directive('trustedTemplate', function($sce) {
+ return {
+ restrict: 'CAM',
+ templateUrl: function() {
+ return $sce.trustAsResourceUrl('http://example.com/trusted-template.html');
+ }
+ };
});
directive('cError', valueFn({
restrict: 'CAM',
templateUrl:'error.html',
compile: function() {
- throw Error('cError');
+ throw new Error('cError');
}
}));
directive('lError', valueFn({
restrict: 'CAM',
templateUrl: 'error.html',
compile: function() {
- throw Error('lError');
+ throw new Error('lError');
}
}));
@@ -848,7 +854,7 @@ describe('$compile', function() {
replace: true,
templateUrl:'error.html',
compile: function() {
- throw Error('cError');
+ throw new Error('cError');
}
}));
directive('iLError', valueFn({
@@ -856,7 +862,7 @@ describe('$compile', function() {
replace: true,
templateUrl: 'error.html',
compile: function() {
- throw Error('lError');
+ throw new Error('lError');
}
}));
@@ -901,23 +907,25 @@ describe('$compile', function() {
));
it('should not load cross domain templates by default', inject(
- function($compile, $rootScope, $templateCache, $sce) {
- expect(function() {
- $templateCache.put('http://example.com/should-not-load.html', 'Should not load even if in cache.');
- $compile('
')($rootScope);
- }).toThrowMinErr('$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: http://example.com/should-not-load.html');
- }));
+ function($compile, $rootScope, $templateCache, $sce) {
+ expect(function() {
+ $templateCache.put('http://example.com/should-not-load.html', 'Should not load even if in cache.');
+ $compile('
')($rootScope);
+ }).toThrowMinErr('$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: http://example.com/should-not-load.html');
+ }
+ ));
it('should load cross domain templates when trusted', inject(
- function($compile, $httpBackend, $rootScope, $sce) {
- $httpBackend.expect('GET', 'http://example.com/trusted-template.html').respond('example.com/trusted_template_contents ');
- element = $compile('
')($rootScope);
- expect(sortedHtml(element)).
- toEqual('
');
- $httpBackend.flush();
- expect(sortedHtml(element)).
- toEqual('example.com/trusted_template_contents
');
- }));
+ function($compile, $httpBackend, $rootScope, $sce) {
+ $httpBackend.expect('GET', 'http://example.com/trusted-template.html').respond('example.com/trusted_template_contents ');
+ element = $compile('
')($rootScope);
+ expect(sortedHtml(element)).
+ toEqual('
');
+ $httpBackend.flush();
+ expect(sortedHtml(element)).
+ toEqual('example.com/trusted_template_contents
');
+ }
+ ));
it('should append template via $http and cache it in $templateCache', inject(
function($compile, $httpBackend, $templateCache, $rootScope, $browser) {
@@ -1275,15 +1283,15 @@ describe('$compile', function() {
function logDirective (name, priority, options) {
directive(name, function(log) {
return (extend({
- priority: priority,
- compile: function() {
- log(name + '-C');
- return {
- pre: function() { log(name + '-PreL'); },
- post: function() { log(name + '-PostL'); }
- }
- }
- }, options || {}));
+ priority: priority,
+ compile: function() {
+ log(name + '-C');
+ return {
+ pre: function() { log(name + '-PreL'); },
+ post: function() { log(name + '-PostL'); }
+ };
+ }
+ }, options || {}));
});
}
@@ -1444,7 +1452,7 @@ describe('$compile', function() {
return {
replace: true,
templateUrl: 'template.html'
- }
+ };
});
});
@@ -2006,9 +2014,9 @@ describe('$compile', function() {
post: function($scope, $element, $attrs) {
log('postLink=' + $attrs.myName);
}
- }
+ };
}
- }
+ };
});
});
module(function() {
@@ -2022,7 +2030,7 @@ describe('$compile', function() {
}
};
}
- }
+ };
});
});
inject(function($rootScope, $compile, log) {
@@ -2133,7 +2141,7 @@ describe('$compile', function() {
it('should translate {{}} in terminal nodes', inject(function($rootScope, $compile) {
- element = $compile('Greet {{name}}! ')($rootScope)
+ element = $compile('Greet {{name}}! ')($rootScope);
$rootScope.$digest();
expect(sortedHtml(element).replace(' selected="true"', '')).
toEqual('' +
@@ -2199,7 +2207,7 @@ describe('$compile', function() {
log(val);
});
}
- }
+ };
});
});
@@ -2212,7 +2220,7 @@ describe('$compile', function() {
expect(log).toEqual(['carrot']);
});
- })
+ });
});
@@ -2225,7 +2233,7 @@ describe('$compile', function() {
return {
restrict: 'ECA',
compile: function() {
- log('t' + uppercase(name))
+ log('t' + uppercase(name));
return {
pre: function() {
log('pre' + uppercase(name));
@@ -2366,7 +2374,7 @@ describe('$compile', function() {
template: {element: templateElement, attr:templateAttr},
link: {element: element, attr: attr}
});
- }
+ };
}
}),
second: valueFn({
@@ -2377,7 +2385,7 @@ describe('$compile', function() {
template: {element: templateElement, attr:templateAttr},
link: {element: element, attr: attr}
});
- }
+ };
}
})
});
@@ -2532,7 +2540,7 @@ describe('$compile', function() {
link: function(scope) {
regularScope = scope;
}
- }
+ };
});
}));
@@ -2544,7 +2552,7 @@ describe('$compile', function() {
});
expect(element.find('input').val()).toBe('from-parent');
expect(componentScope).not.toBe(regularScope);
- expect(componentScope.$parent).toBe(regularScope)
+ expect(componentScope.$parent).toBe(regularScope);
}));
@@ -2579,7 +2587,7 @@ describe('$compile', function() {
});
inject(function($rootScope, $templateCache) {
- $templateCache.put('other.html', 'value: {{value}}')
+ $templateCache.put('other.html', 'value: {{value}}');
compile('');
$rootScope.$apply(function() {
@@ -2658,14 +2666,14 @@ describe('$compile', function() {
componentScope.ref = 'misko';
$rootScope.$apply();
- expect($rootScope.name).toEqual({mark:123})
+ expect($rootScope.name).toEqual({mark:123});
expect(componentScope.ref).toBe($rootScope.name);
expect(componentScope.refAlias).toBe($rootScope.name);
$rootScope.name = 'igor';
componentScope.ref = {};
$rootScope.$apply();
- expect($rootScope.name).toEqual('igor')
+ expect($rootScope.name).toEqual('igor');
expect(componentScope.ref).toBe($rootScope.name);
expect(componentScope.refAlias).toBe($rootScope.name);
}));
@@ -3084,7 +3092,7 @@ describe('$compile', function() {
link: function($scope, $element) {
log($element.attr('scope-tester') + '=' + ($scope.$root === $scope ? 'non-isolate' : 'isolate'));
}
- }
+ };
});
});
@@ -3098,7 +3106,7 @@ describe('$compile', function() {
expect(log).toEqual('inside=isolate; ' +
'outside replaced=non-isolate; ' + // outside
'outside replaced=isolate; ' + // replaced
- 'sibling=non-isolate')
+ 'sibling=non-isolate');
});
});
@@ -3280,7 +3288,7 @@ describe('$compile', function() {
controller: asyncCtrlSpy,
compile: function() {
return function() {
- }
+ };
}
}));
});
@@ -3340,7 +3348,7 @@ describe('$compile', function() {
element = $compile('
')($rootScope);
$rootScope.$apply();
expect(log).toEqual('parentController; childController');
- expect(element.text()).toBe('childTemplateText;childContentText;')
+ expect(element.text()).toBe('childTemplateText;childContentText;');
});
});
@@ -3444,7 +3452,7 @@ describe('$compile', function() {
'
')($rootScope);
$rootScope.$apply();
expect(log).toEqual('parentController; childController; babyController');
- expect(element.text()).toBe('childContentText;babyTemplateText;')
+ expect(element.text()).toBe('childContentText;babyTemplateText;');
});
});
@@ -3547,7 +3555,7 @@ describe('$compile', function() {
replace: true,
scope: true,
template: 'W:{{$parent.$id}}-{{$id}}; '
- }
+ };
});
});
inject(function(log, $rootScope, $compile) {
@@ -3579,7 +3587,7 @@ describe('$compile', function() {
$httpBackend.
expect('GET', 'chapter.html').
respond('');
- }
+ };
});
inject(function(log, $rootScope, $compile, $httpBackend) {
element = $compile('')($rootScope);
@@ -3697,9 +3705,9 @@ describe('$compile', function() {
$compile('')($rootScope);
} catch(e) {
expect(e.message).toMatch(new RegExp(
- '^\\\[ngTransclude:orphan\\\] ' +
+ '^\\[ngTransclude:orphan\\] ' +
'Illegal use of ngTransclude directive in the template! ' +
- 'No parent directive that requires a transclusion found\. ' +
+ 'No parent directive that requires a transclusion found\\. ' +
'Element:
')($rootScope);
- expect(_$transclude).toBeDefined()
+ expect(_$transclude).toBeDefined();
});
});
@@ -4243,7 +4251,8 @@ describe('$compile', function() {
expect(log.toArray()).toEqual([
"outer:#comment:outer:",
"innerAgain:#comment:innerAgain:",
- "inner:#comment:innerAgain:"]);
+ "inner:#comment:innerAgain:"
+ ]);
expect(child.length).toBe(1);
expect(child.contents().length).toBe(2);
expect(lowercase(nodeName_(child.contents().eq(0)))).toBe('#comment');
@@ -4277,6 +4286,7 @@ describe('$compile', function() {
}));
it('should not sanitize attributes other than src', inject(function($compile, $rootScope) {
+ /* jshint scripturl:true */
element = $compile(' ')($rootScope);
$rootScope.testUrl = "javascript:doEvilStuff()";
$rootScope.$apply();
@@ -4321,6 +4331,7 @@ describe('$compile', function() {
describe('a[href] sanitization', function() {
it('should not sanitize href on elements other than anchor', inject(function($compile, $rootScope) {
+ /* jshint scripturl:true */
element = $compile('
')($rootScope);
$rootScope.testUrl = "javascript:doEvilStuff()";
$rootScope.$apply();
@@ -4329,6 +4340,7 @@ describe('$compile', function() {
}));
it('should not sanitize attributes other than href', inject(function($compile, $rootScope) {
+ /* jshint scripturl:true */
element = $compile(' ')($rootScope);
$rootScope.testUrl = "javascript:doEvilStuff()";
$rootScope.$apply();
@@ -4392,6 +4404,7 @@ describe('$compile', function() {
}));
it('should pass through arbitrary values on onXYZ event attributes that contain a hyphen', inject(function($compile, $rootScope) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.onClickJs = 'javascript:doSomething()';
$rootScope.$apply();
@@ -4422,22 +4435,24 @@ describe('$compile', function() {
it('should clear out src attributes for a different domain', inject(function($compile, $rootScope, $sce) {
element = $compile('')($rootScope);
$rootScope.testUrl = "http://a.different.domain.example.com";
- expect(function() { $rootScope.$apply() }).toThrowMinErr(
+ expect(function() { $rootScope.$apply(); }).toThrowMinErr(
"$interpolate", "interr", "Can't interpolate: {{testUrl}}\nError: [$sce:insecurl] Blocked " +
"loading resource from url not allowed by $sceDelegate policy. URL: " +
"http://a.different.domain.example.com");
}));
it('should clear out JS src attributes', inject(function($compile, $rootScope, $sce) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.testUrl = "javascript:alert(1);";
- expect(function() { $rootScope.$apply() }).toThrowMinErr(
+ expect(function() { $rootScope.$apply(); }).toThrowMinErr(
"$interpolate", "interr", "Can't interpolate: {{testUrl}}\nError: [$sce:insecurl] Blocked " +
"loading resource from url not allowed by $sceDelegate policy. URL: " +
"javascript:alert(1);");
}));
it('should clear out non-resource_url src attributes', inject(function($compile, $rootScope, $sce) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.testUrl = $sce.trustAsUrl("javascript:doTrustedStuff()");
expect($rootScope.$apply).toThrowMinErr(
@@ -4446,6 +4461,7 @@ describe('$compile', function() {
}));
it('should pass through $sce.trustAs() values in src attributes', inject(function($compile, $rootScope, $sce) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.testUrl = $sce.trustAsResourceUrl("javascript:doTrustedStuff()");
$rootScope.$apply();
@@ -4465,22 +4481,24 @@ describe('$compile', function() {
it('should clear out action attribute for a different domain', inject(function($compile, $rootScope, $sce) {
element = $compile('')($rootScope);
$rootScope.testUrl = "http://a.different.domain.example.com";
- expect(function() { $rootScope.$apply() }).toThrowMinErr(
+ expect(function() { $rootScope.$apply(); }).toThrowMinErr(
"$interpolate", "interr", "Can't interpolate: {{testUrl}}\nError: [$sce:insecurl] Blocked " +
"loading resource from url not allowed by $sceDelegate policy. URL: " +
"http://a.different.domain.example.com");
}));
it('should clear out JS action attribute', inject(function($compile, $rootScope, $sce) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.testUrl = "javascript:alert(1);";
- expect(function() { $rootScope.$apply() }).toThrowMinErr(
+ expect(function() { $rootScope.$apply(); }).toThrowMinErr(
"$interpolate", "interr", "Can't interpolate: {{testUrl}}\nError: [$sce:insecurl] Blocked " +
"loading resource from url not allowed by $sceDelegate policy. URL: " +
"javascript:alert(1);");
}));
it('should clear out non-resource_url action attribute', inject(function($compile, $rootScope, $sce) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.testUrl = $sce.trustAsUrl("javascript:doTrustedStuff()");
expect($rootScope.$apply).toThrowMinErr(
@@ -4489,6 +4507,7 @@ describe('$compile', function() {
}));
it('should pass through $sce.trustAs() values in action attribute', inject(function($compile, $rootScope, $sce) {
+ /* jshint scripturl:true */
element = $compile('')($rootScope);
$rootScope.testUrl = $sce.trustAsResourceUrl("javascript:doTrustedStuff()");
$rootScope.$apply();
diff --git a/test/ng/controllerSpec.js b/test/ng/controllerSpec.js
index 4f94402fe0e9..8c091746ef96 100644
--- a/test/ng/controllerSpec.js
+++ b/test/ng/controllerSpec.js
@@ -16,7 +16,7 @@ describe('$controller', function() {
describe('provider', function() {
it('should allow registration of controllers', function() {
- var FooCtrl = function($scope) { $scope.foo = 'bar' },
+ var FooCtrl = function($scope) { $scope.foo = 'bar'; },
scope = {},
ctrl;
@@ -29,8 +29,8 @@ describe('$controller', function() {
it('should allow registration of map of controllers', function() {
- var FooCtrl = function($scope) { $scope.foo = 'foo' },
- BarCtrl = function($scope) { $scope.bar = 'bar' },
+ var FooCtrl = function($scope) { $scope.foo = 'foo'; },
+ BarCtrl = function($scope) { $scope.bar = 'bar'; },
scope = {},
ctrl;
@@ -47,7 +47,7 @@ describe('$controller', function() {
it('should allow registration of controllers annotated with arrays', function() {
- var FooCtrl = function($scope) { $scope.foo = 'bar' },
+ var FooCtrl = function($scope) { $scope.foo = 'bar'; },
scope = {},
ctrl;
diff --git a/test/ng/directive/booleanAttrsSpec.js b/test/ng/directive/booleanAttrsSpec.js
index 2d800f5b3ab9..6bcb57eeb2b8 100644
--- a/test/ng/directive/booleanAttrsSpec.js
+++ b/test/ng/directive/booleanAttrsSpec.js
@@ -10,7 +10,7 @@ describe('boolean attr directives', function() {
it('should properly evaluate 0 as false', inject(function($rootScope, $compile) {
// jQuery does not treat 0 as false, when setting attr()
- element = $compile('Button ')($rootScope)
+ element = $compile('Button ')($rootScope);
$rootScope.isDisabled = 0;
$rootScope.$digest();
expect(element.attr('disabled')).toBeFalsy();
@@ -21,7 +21,7 @@ describe('boolean attr directives', function() {
it('should bind disabled', inject(function($rootScope, $compile) {
- element = $compile('Button ')($rootScope)
+ element = $compile('Button ')($rootScope);
$rootScope.isDisabled = false;
$rootScope.$digest();
expect(element.attr('disabled')).toBeFalsy();
@@ -32,7 +32,7 @@ describe('boolean attr directives', function() {
it('should bind checked', inject(function($rootScope, $compile) {
- element = $compile(' ')($rootScope)
+ element = $compile(' ')($rootScope);
$rootScope.isChecked = false;
$rootScope.$digest();
expect(element.attr('checked')).toBeFalsy();
@@ -43,8 +43,8 @@ describe('boolean attr directives', function() {
it('should bind selected', inject(function($rootScope, $compile) {
- element = $compile('Greetings! ')($rootScope)
- jqLite(document.body).append(element)
+ element = $compile('Greetings! ')($rootScope);
+ jqLite(document.body).append(element);
$rootScope.isSelected=false;
$rootScope.$digest();
expect(element.children()[1].selected).toBeFalsy();
@@ -55,7 +55,7 @@ describe('boolean attr directives', function() {
it('should bind readonly', inject(function($rootScope, $compile) {
- element = $compile(' ')($rootScope)
+ element = $compile(' ')($rootScope);
$rootScope.isReadonly=false;
$rootScope.$digest();
expect(element.attr('readOnly')).toBeFalsy();
@@ -66,7 +66,7 @@ describe('boolean attr directives', function() {
it('should bind open', inject(function($rootScope, $compile) {
- element = $compile(' ')($rootScope)
+ element = $compile(' ')($rootScope);
$rootScope.isOpen=false;
$rootScope.$digest();
expect(element.attr('open')).toBeFalsy();
@@ -78,7 +78,7 @@ describe('boolean attr directives', function() {
describe('multiple', function() {
it('should NOT bind to multiple via ngMultiple', inject(function($rootScope, $compile) {
- element = $compile(' ')($rootScope)
+ element = $compile(' ')($rootScope);
$rootScope.isMultiple=false;
$rootScope.$digest();
expect(element.attr('multiple')).toBeFalsy();
@@ -92,7 +92,7 @@ describe('boolean attr directives', function() {
if (msie < 9) return; //IE8 doesn't support biding to boolean attributes
expect(function() {
- $compile(' ')
+ $compile(' ');
}).toThrowMinErr('$compile', 'selmulti', 'Binding to the \'multiple\' attribute is not supported. ' +
'Element: ');
@@ -225,7 +225,7 @@ describe('ngHref', function() {
it('should interpolate the expression and bind to href', inject(function($compile, $rootScope) {
- element = $compile('
')($rootScope)
+ element = $compile('
')($rootScope);
$rootScope.$digest();
expect(element.attr('href')).toEqual('some/');
@@ -247,7 +247,7 @@ describe('ngHref', function() {
it('should bind href even if no interpolation', inject(function($rootScope, $compile) {
- element = $compile(' ')($rootScope)
+ element = $compile(' ')($rootScope);
$rootScope.$digest();
expect(element.attr('href')).toEqual('http://server');
}));
diff --git a/test/ng/directive/formSpec.js b/test/ng/directive/formSpec.js
index b55d1f8d1a78..b9f0ded777b9 100644
--- a/test/ng/directive/formSpec.js
+++ b/test/ng/directive/formSpec.js
@@ -1,3 +1,4 @@
+/* global FormController: false */
'use strict';
describe('form', function() {
@@ -148,9 +149,9 @@ describe('form', function() {
' '+
' '+
'');
- expect(function() {
- $compile(doc)(scope);
- }).toThrowMinErr('ng', 'badname');
+ expect(function() {
+ $compile(doc)(scope);
+ }).toThrowMinErr('ng', 'badname');
});
@@ -177,7 +178,7 @@ describe('form', function() {
scope.submitMe = function() {
submitted = true;
- }
+ };
if (msie!=8) addEventListenerFn(doc[0], 'submit', assertPreventDefaultListener);
@@ -218,11 +219,11 @@ describe('form', function() {
// $location change) that will cause some directive to destroy the dom (e.g. ngView+$route)
doc.empty();
destroyed = true;
- }
+ };
scope.submitMe = function() {
submitted = true;
- }
+ };
var assertPreventDefaultListener = function(e) {
reloadPrevented = e.defaultPrevented || (e.returnValue === false);
@@ -434,7 +435,7 @@ describe('form', function() {
expect(parent.$error.myRule).toBe(false);
expect(child.$error.myRule).toBe(false);
});
- })
+ });
describe('validation', function() {
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js
index e9b28f1e7464..a87d3cc51261 100644
--- a/test/ng/directive/inputSpec.js
+++ b/test/ng/directive/inputSpec.js
@@ -1,6 +1,7 @@
'use strict';
describe('NgModelController', function() {
+ /* global NgModelController: false */
var ctrl, scope, ngModelAccessor, element, parentFormCtrl;
beforeEach(inject(function($rootScope, $controller) {
@@ -9,7 +10,7 @@ describe('NgModelController', function() {
parentFormCtrl = {
$setValidity: jasmine.createSpy('$setValidity'),
$setDirty: jasmine.createSpy('$setDirty')
- }
+ };
element = jqLite('');
element.data('$formController', parentFormCtrl);
@@ -17,7 +18,9 @@ describe('NgModelController', function() {
scope = $rootScope;
ngModelAccessor = jasmine.createSpy('ngModel accessor');
ctrl = $controller(NgModelController, {
- $scope: scope, $element: element.find('input'), $attrs: attrs
+ $scope: scope,
+ $element: element.find('input'),
+ $attrs: attrs
});
}));
@@ -387,24 +390,24 @@ describe('ngModel', function() {
it('should keep previously defined watches consistent when changes in validity are made',
inject(function($compile, $rootScope) {
- var isFormValid;
- $rootScope.$watch('myForm.$valid', function(value) { isFormValid = value; });
+ var isFormValid;
+ $rootScope.$watch('myForm.$valid', function(value) { isFormValid = value; });
- var element = $compile('')($rootScope);
- $rootScope.$apply();
- expect(isFormValid).toBe(false);
- expect($rootScope.myForm.$valid).toBe(false);
+ $rootScope.$apply();
+ expect(isFormValid).toBe(false);
+ expect($rootScope.myForm.$valid).toBe(false);
- $rootScope.value='value';
- $rootScope.$apply();
- expect(isFormValid).toBe(true);
- expect($rootScope.myForm.$valid).toBe(true);
+ $rootScope.value='value';
+ $rootScope.$apply();
+ expect(isFormValid).toBe(true);
+ expect($rootScope.myForm.$valid).toBe(true);
- dealoc(element);
- }));
+ dealoc(element);
+ }));
});
@@ -454,7 +457,7 @@ describe('input', function() {
this.message = function() {
return "Attribute '" + attributeName + "' expected to be off but was '" + actualValue +
"' in: " + angular.mock.dump(this.actual);
- }
+ };
return !actualValue || actualValue == 'false';
}
@@ -477,7 +480,7 @@ describe('input', function() {
expect(scope.name).toEqual('adam');
});
- if (!(msie < 9)) {
+ if (!msie || msie >= 9) {
describe('compositionevents', function() {
it('should not update the model between "compositionstart" and "compositionend" on non android', inject(function($sniffer) {
$sniffer.android = false;
@@ -511,7 +514,7 @@ describe('input', function() {
it('should update the model on "compositionend"', function() {
compileInput(' ');
- if (!(msie < 9)) {
+ if (!msie || msie >= 9) {
browserTrigger(inputElm, 'compositionstart');
changeInputValueTo('caitp');
expect(scope.name).toBeUndefined();
@@ -1063,409 +1066,409 @@ describe('input', function() {
// INPUT TYPES
describe('month', function (){
- it('should render blank if model is not a Date object', function() {
- compileInput(' ');
+ it('should render blank if model is not a Date object', function() {
+ compileInput(' ');
+
+ scope.$apply(function(){
+ scope.january = '2013-01';
+ });
+
+ expect(inputElm.val()).toBe('');
+ });
- scope.$apply(function(){
- scope.january = '2013-01';
- });
+ it('should set the view if the model is a valid Date object', function (){
+ compileInput(' ');
- expect(inputElm.val()).toBe('');
+ scope.$apply(function(){
+ scope.march = new Date(2013, 2, 1);
});
- it('should set the view if the model is a valid Date object', function (){
- compileInput(' ');
+ expect(inputElm.val()).toBe('2013-03');
+ });
- scope.$apply(function(){
- scope.march = new Date(2013, 2, 1);
- });
+ it('should set the model undefined if the input is an invalid month string', function () {
+ compileInput(' ');
- expect(inputElm.val()).toBe('2013-03');
+ scope.$apply(function(){
+ scope.value = new Date(2013, 0, 1);
});
- it('should set the model undefined if the input is an invalid month string', function () {
- compileInput(' ');
- scope.$apply(function(){
- scope.value = new Date(2013, 0, 1);
- });
+ expect(inputElm.val()).toBe('2013-01');
+ try {
+ //set to text for browsers with datetime-local validation.
+ inputElm[0].setAttribute('type', 'text');
+ } catch(e) {
+ //for IE8
+ }
- expect(inputElm.val()).toBe('2013-01');
+ changeInputValueTo('stuff');
+ expect(inputElm.val()).toBe('stuff');
+ expect(scope.value).toBeUndefined();
+ expect(inputElm).toBeInvalid();
+ });
- try {
- //set to text for browsers with datetime-local validation.
- inputElm[0].setAttribute('type', 'text');
- } catch(e) {
- //for IE8
- }
+ it('should render as blank if null', function() {
+ compileInput(' ');
- changeInputValueTo('stuff');
- expect(inputElm.val()).toBe('stuff');
- expect(scope.value).toBeUndefined();
- expect(inputElm).toBeInvalid();
+ scope.$apply(function() {
+ scope.test = null;
});
- it('should render as blank if null', function() {
- compileInput(' ');
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toEqual('');
+ });
+
+ it('should come up blank when no value specified', function() {
+ compileInput(' ');
- scope.$apply(function() {
- scope.test = null;
- });
+ scope.$digest();
+ expect(inputElm.val()).toBe('');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toEqual('');
+ scope.$apply(function() {
+ scope.test = null;
});
- it('should come up blank when no value specified', function() {
- compileInput(' ');
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toBe('');
+ });
- scope.$digest();
- expect(inputElm.val()).toBe('');
- scope.$apply(function() {
- scope.test = null;
- });
+ it('should parse empty string to null', function() {
+ compileInput(' ');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toBe('');
+ scope.$apply(function() {
+ scope.test = new Date(2011, 0, 1);
});
+ changeInputValueTo('');
+ expect(scope.test).toBeNull();
+ expect(inputElm).toBeValid();
+ });
- it('should parse empty string to null', function() {
- compileInput(' ');
- scope.$apply(function() {
- scope.test = new Date(2011, 0, 1);
- });
+ describe('min', function (){
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- changeInputValueTo('');
- expect(scope.test).toBeNull();
- expect(inputElm).toBeValid();
+ it('should invalidate', function (){
+ changeInputValueTo('2012-12');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeFalsy();
+ expect(scope.form.alias.$error.min).toBeTruthy();
+ });
+
+ it('should validate', function (){
+ changeInputValueTo('2013-07');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2013, 6, 1));
+ expect(scope.form.alias.$error.min).toBeFalsy();
+ });
+ });
+
+ describe('max', function(){
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
});
+ it('should validate', function (){
+ changeInputValueTo('2012-03');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2012, 2, 1));
+ expect(scope.form.alias.$error.max).toBeFalsy();
+ });
- describe('min', function (){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
-
- it('should invalidate', function (){
- changeInputValueTo('2012-12');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeFalsy();
- expect(scope.form.alias.$error.min).toBeTruthy();
- });
-
- it('should validate', function (){
- changeInputValueTo('2013-07');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2013, 6, 1));
- expect(scope.form.alias.$error.min).toBeFalsy();
- });
- });
-
- describe('max', function(){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
-
- it('should validate', function (){
- changeInputValueTo('2012-03');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2012, 2, 1));
- expect(scope.form.alias.$error.max).toBeFalsy();
- });
-
- it('should invalidate', function (){
- changeInputValueTo('2013-05');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeUndefined();
- expect(scope.form.alias.$error.max).toBeTruthy();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('2013-05');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeUndefined();
+ expect(scope.form.alias.$error.max).toBeTruthy();
});
+ });
});
- describe('week', function (){
- it('should set render blank if model is not a Date object', function() {
- compileInput(' ');
+ describe('week', function (){
+ it('should set render blank if model is not a Date object', function() {
+ compileInput(' ');
+
+ scope.$apply(function(){
+ scope.secondWeek = '2013-W02';
+ });
+
+ expect(inputElm.val()).toBe('');
+ });
- scope.$apply(function(){
- scope.secondWeek = '2013-W02';
- });
+ it('should set the view if the model is a valid Date object', function (){
+ compileInput(' ');
- expect(inputElm.val()).toBe('');
+ scope.$apply(function(){
+ scope.secondWeek = new Date(2013, 0, 11);
});
- it('should set the view if the model is a valid Date object', function (){
- compileInput(' ');
+ expect(inputElm.val()).toBe('2013-W02');
+ });
- scope.$apply(function(){
- scope.secondWeek = new Date(2013, 0, 11);
- });
+ it('should set the model undefined if the input is an invalid week string', function () {
+ compileInput(' ');
- expect(inputElm.val()).toBe('2013-W02');
+ scope.$apply(function(){
+ scope.value = new Date(2013, 0, 11);
});
- it('should set the model undefined if the input is an invalid week string', function () {
- compileInput(' ');
- scope.$apply(function(){
- scope.value = new Date(2013, 0, 11);
- });
+ expect(inputElm.val()).toBe('2013-W02');
+ try {
+ //set to text for browsers with datetime-local validation.
+ inputElm[0].setAttribute('type', 'text');
+ } catch(e) {
+ //for IE8
+ }
- expect(inputElm.val()).toBe('2013-W02');
+ changeInputValueTo('stuff');
+ expect(inputElm.val()).toBe('stuff');
+ expect(scope.value).toBeUndefined();
+ expect(inputElm).toBeInvalid();
+ });
- try {
- //set to text for browsers with datetime-local validation.
- inputElm[0].setAttribute('type', 'text');
- } catch(e) {
- //for IE8
- }
+ it('should render as blank if null', function() {
+ compileInput(' ');
- changeInputValueTo('stuff');
- expect(inputElm.val()).toBe('stuff');
- expect(scope.value).toBeUndefined();
- expect(inputElm).toBeInvalid();
+ scope.$apply(function() {
+ scope.test = null;
});
- it('should render as blank if null', function() {
- compileInput(' ');
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toEqual('');
+ });
- scope.$apply(function() {
- scope.test = null;
- });
+ it('should come up blank when no value specified', function() {
+ compileInput(' ');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toEqual('');
- });
+ scope.$digest();
+ expect(inputElm.val()).toBe('');
- it('should come up blank when no value specified', function() {
- compileInput(' ');
+ scope.$apply(function() {
+ scope.test = null;
+ });
- scope.$digest();
- expect(inputElm.val()).toBe('');
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toBe('');
+ });
- scope.$apply(function() {
- scope.test = null;
- });
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toBe('');
- });
+ it('should parse empty string to null', function() {
+ compileInput(' ');
+ scope.$apply(function() {
+ scope.test = new Date(2011, 0, 1);
+ });
- it('should parse empty string to null', function() {
- compileInput(' ');
+ changeInputValueTo('');
+ expect(scope.test).toBeNull();
+ expect(inputElm).toBeValid();
+ });
- scope.$apply(function() {
- scope.test = new Date(2011, 0, 1);
- });
+ describe('min', function (){
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- changeInputValueTo('');
- expect(scope.test).toBeNull();
- expect(inputElm).toBeValid();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('2012-W12');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeFalsy();
+ expect(scope.form.alias.$error.min).toBeTruthy();
+ });
- describe('min', function (){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
+ it('should validate', function (){
+ changeInputValueTo('2013-W03');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2013, 0, 17));
+ expect(scope.form.alias.$error.min).toBeFalsy();
+ });
+ });
- it('should invalidate', function (){
- changeInputValueTo('2012-W12');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeFalsy();
- expect(scope.form.alias.$error.min).toBeTruthy();
- });
+ describe('max', function(){
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- it('should validate', function (){
- changeInputValueTo('2013-W03');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2013, 0, 17));
- expect(scope.form.alias.$error.min).toBeFalsy();
- });
+ it('should validate', function (){
+ changeInputValueTo('2012-W01');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2012, 0, 5));
+ expect(scope.form.alias.$error.max).toBeFalsy();
});
- describe('max', function(){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('2013-W03');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeUndefined();
+ expect(scope.form.alias.$error.max).toBeTruthy();
+ });
+ });
+ });
- it('should validate', function (){
- changeInputValueTo('2012-W01');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2012, 0, 5));
- expect(scope.form.alias.$error.max).toBeFalsy();
- });
+ describe('datetime-local', function () {
+ it('should render blank if model is not a Date object', function() {
+ compileInput(' ');
- it('should invalidate', function (){
- changeInputValueTo('2013-W03');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeUndefined();
- expect(scope.form.alias.$error.max).toBeTruthy();
- });
+ scope.$apply(function(){
+ scope.lunchtime = '2013-12-16T11:30';
});
- });
- describe('datetime-local', function () {
- it('should render blank if model is not a Date object', function() {
- compileInput(' ');
+ expect(inputElm.val()).toBe('');
+ });
- scope.$apply(function(){
- scope.lunchtime = '2013-12-16T11:30';
- });
+ it('should set the view if the model if a valid Date object.', function(){
+ compileInput(' ');
- expect(inputElm.val()).toBe('');
+ scope.$apply(function (){
+ scope.tenSecondsToNextYear = new Date(2013, 11, 31, 23, 59);
});
- it('should set the view if the model if a valid Date object.', function(){
- compileInput(' ');
+ expect(inputElm.val()).toBe('2013-12-31T23:59');
+ });
- scope.$apply(function (){
- scope.tenSecondsToNextYear = new Date(2013, 11, 31, 23, 59);
- });
+ it('should set the model undefined if the view is invalid', function (){
+ compileInput(' ');
- expect(inputElm.val()).toBe('2013-12-31T23:59');
+ scope.$apply(function (){
+ scope.breakMe = new Date(2009, 0, 6, 16, 25);
});
- it('should set the model undefined if the view is invalid', function (){
- compileInput(' ');
+ expect(inputElm.val()).toBe('2009-01-06T16:25');
- scope.$apply(function (){
- scope.breakMe = new Date(2009, 0, 6, 16, 25);
- });
+ try {
+ //set to text for browsers with datetime-local validation.
+ inputElm[0].setAttribute('type', 'text');
+ } catch(e) {
+ //for IE8
+ }
- expect(inputElm.val()).toBe('2009-01-06T16:25');
+ changeInputValueTo('stuff');
+ expect(inputElm.val()).toBe('stuff');
+ expect(scope.breakMe).toBeUndefined();
+ expect(inputElm).toBeInvalid();
+ });
- try {
- //set to text for browsers with datetime-local validation.
- inputElm[0].setAttribute('type', 'text');
- } catch(e) {
- //for IE8
- }
+ it('should render as blank if null', function() {
+ compileInput(' ');
- changeInputValueTo('stuff');
- expect(inputElm.val()).toBe('stuff');
- expect(scope.breakMe).toBeUndefined();
- expect(inputElm).toBeInvalid();
+ scope.$apply(function() {
+ scope.test = null;
});
- it('should render as blank if null', function() {
- compileInput(' ');
-
- scope.$apply(function() {
- scope.test = null;
- });
-
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toEqual('');
- });
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toEqual('');
+ });
- it('should come up blank when no value specified', function() {
- compileInput(' ');
+ it('should come up blank when no value specified', function() {
+ compileInput(' ');
- scope.$digest();
- expect(inputElm.val()).toBe('');
+ scope.$digest();
+ expect(inputElm.val()).toBe('');
- scope.$apply(function() {
- scope.test = null;
- });
+ scope.$apply(function() {
+ scope.test = null;
+ });
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toBe('');
- });
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toBe('');
+ });
- it('should parse empty string to null', function() {
- compileInput(' ');
+ it('should parse empty string to null', function() {
+ compileInput(' ');
- scope.$apply(function() {
- scope.test = new Date(2011, 0, 1);
- });
+ scope.$apply(function() {
+ scope.test = new Date(2011, 0, 1);
+ });
- changeInputValueTo('');
- expect(scope.test).toBeNull();
- expect(inputElm).toBeValid();
- });
+ changeInputValueTo('');
+ expect(scope.test).toBeNull();
+ expect(inputElm).toBeValid();
+ });
- describe('min', function (){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
+ describe('min', function (){
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- it('should invalidate', function (){
- changeInputValueTo('1999-12-31T01:02');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeFalsy();
- expect(scope.form.alias.$error.min).toBeTruthy();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('1999-12-31T01:02');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeFalsy();
+ expect(scope.form.alias.$error.min).toBeTruthy();
+ });
- it('should validate', function (){
- changeInputValueTo('2000-01-01T23:02');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2000, 0, 1, 23, 2));
- expect(scope.form.alias.$error.min).toBeFalsy();
- });
+ it('should validate', function (){
+ changeInputValueTo('2000-01-01T23:02');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2000, 0, 1, 23, 2));
+ expect(scope.form.alias.$error.min).toBeFalsy();
});
+ });
- describe('max', function (){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
+ describe('max', function (){
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- it('should invalidate', function (){
- changeInputValueTo('2019-12-31T01:02');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeFalsy();
- expect(scope.form.alias.$error.max).toBeTruthy();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('2019-12-31T01:02');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeFalsy();
+ expect(scope.form.alias.$error.max).toBeTruthy();
+ });
- it('should validate', function() {
- changeInputValueTo('2000-01-01T01:02');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2000, 0, 1, 1, 2));
- expect(scope.form.alias.$error.max).toBeFalsy();
- });
+ it('should validate', function() {
+ changeInputValueTo('2000-01-01T01:02');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2000, 0, 1, 1, 2));
+ expect(scope.form.alias.$error.max).toBeFalsy();
});
+ });
- it('should validate even if max value changes on-the-fly', function(done) {
- scope.max = '2013-01-01T01:02';
- compileInput(' ');
- scope.$digest();
+ it('should validate even if max value changes on-the-fly', function(done) {
+ scope.max = '2013-01-01T01:02';
+ compileInput(' ');
+ scope.$digest();
- changeInputValueTo('2014-01-01T12:34');
- expect(inputElm).toBeInvalid();
+ changeInputValueTo('2014-01-01T12:34');
+ expect(inputElm).toBeInvalid();
- scope.max = '2001-01-01T01:02';
- scope.$digest(function () {
- expect(inputElm).toBeValid();
- done();
- });
+ scope.max = '2001-01-01T01:02';
+ scope.$digest(function () {
+ expect(inputElm).toBeValid();
+ done();
});
+ });
- it('should validate even if min value changes on-the-fly', function(done) {
- scope.min = '2013-01-01T01:02';
- compileInput(' ');
- scope.$digest();
+ it('should validate even if min value changes on-the-fly', function(done) {
+ scope.min = '2013-01-01T01:02';
+ compileInput(' ');
+ scope.$digest();
- changeInputValueTo('2010-01-01T12:34');
- expect(inputElm).toBeInvalid();
+ changeInputValueTo('2010-01-01T12:34');
+ expect(inputElm).toBeInvalid();
- scope.min = '2014-01-01T01:02';
- scope.$digest(function () {
- expect(inputElm).toBeValid();
- done();
- });
+ scope.min = '2014-01-01T01:02';
+ scope.$digest(function () {
+ expect(inputElm).toBeValid();
+ done();
});
- });
+ });
+ });
describe('time', function () {
it('should render blank if model is not a Date object', function() {
@@ -1510,44 +1513,44 @@ describe('input', function() {
expect(inputElm).toBeInvalid();
});
- it('should render as blank if null', function() {
- compileInput(' ');
-
- scope.$apply(function() {
- scope.test = null;
- });
+ it('should render as blank if null', function() {
+ compileInput(' ');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toEqual('');
+ scope.$apply(function() {
+ scope.test = null;
});
- it('should come up blank when no value specified', function() {
- compileInput(' ');
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toEqual('');
+ });
- scope.$digest();
- expect(inputElm.val()).toBe('');
+ it('should come up blank when no value specified', function() {
+ compileInput(' ');
- scope.$apply(function() {
- scope.test = null;
- });
+ scope.$digest();
+ expect(inputElm.val()).toBe('');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toBe('');
+ scope.$apply(function() {
+ scope.test = null;
});
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toBe('');
+ });
- it('should parse empty string to null', function() {
- compileInput(' ');
- scope.$apply(function() {
- scope.test = new Date(2011, 0, 1);
- });
+ it('should parse empty string to null', function() {
+ compileInput(' ');
- changeInputValueTo('');
- expect(scope.test).toBeNull();
- expect(inputElm).toBeValid();
+ scope.$apply(function() {
+ scope.test = new Date(2011, 0, 1);
});
+ changeInputValueTo('');
+ expect(scope.test).toBeNull();
+ expect(inputElm).toBeValid();
+ });
+
describe('min', function (){
beforeEach(function (){
compileInput(' ');
@@ -1623,125 +1626,125 @@ describe('input', function() {
describe('date', function () {
it('should render blank if model is not a Date object.', function() {
- compileInput(' ');
+ compileInput(' ');
- scope.$apply(function(){
- scope.birthday = '1977-10-22';
- });
+ scope.$apply(function(){
+ scope.birthday = '1977-10-22';
+ });
- expect(inputElm.val()).toBe('');
+ expect(inputElm.val()).toBe('');
});
it('should set the view if the model if a valid Date object.', function(){
- compileInput(' ');
+ compileInput(' ');
- scope.$apply(function (){
- scope.christmas = new Date(2013, 11, 25);
- });
+ scope.$apply(function (){
+ scope.christmas = new Date(2013, 11, 25);
+ });
- expect(inputElm.val()).toBe('2013-12-25');
+ expect(inputElm.val()).toBe('2013-12-25');
});
it('should set the model undefined if the view is invalid', function (){
- compileInput(' ');
+ compileInput(' ');
- scope.$apply(function (){
- scope.arrMatey = new Date(2014, 8, 14);
- });
+ scope.$apply(function (){
+ scope.arrMatey = new Date(2014, 8, 14);
+ });
- expect(inputElm.val()).toBe('2014-09-14');
+ expect(inputElm.val()).toBe('2014-09-14');
- try {
- //set to text for browsers with date validation.
- inputElm[0].setAttribute('type', 'text');
- } catch(e) {
- //for IE8
- }
+ try {
+ //set to text for browsers with date validation.
+ inputElm[0].setAttribute('type', 'text');
+ } catch(e) {
+ //for IE8
+ }
- changeInputValueTo('1-2-3');
- expect(inputElm.val()).toBe('1-2-3');
- expect(scope.arrMatey).toBeUndefined();
- expect(inputElm).toBeInvalid();
+ changeInputValueTo('1-2-3');
+ expect(inputElm.val()).toBe('1-2-3');
+ expect(scope.arrMatey).toBeUndefined();
+ expect(inputElm).toBeInvalid();
});
- it('should render as blank if null', function() {
- compileInput(' ');
-
- scope.$apply(function() {
- scope.test = null;
- });
+ it('should render as blank if null', function() {
+ compileInput(' ');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toEqual('');
+ scope.$apply(function() {
+ scope.test = null;
});
- it('should come up blank when no value specified', function() {
- compileInput(' ');
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toEqual('');
+ });
- scope.$digest();
- expect(inputElm.val()).toBe('');
+ it('should come up blank when no value specified', function() {
+ compileInput(' ');
- scope.$apply(function() {
- scope.test = null;
- });
+ scope.$digest();
+ expect(inputElm.val()).toBe('');
- expect(scope.test).toBeNull();
- expect(inputElm.val()).toBe('');
+ scope.$apply(function() {
+ scope.test = null;
});
+ expect(scope.test).toBeNull();
+ expect(inputElm.val()).toBe('');
+ });
- it('should parse empty string to null', function() {
- compileInput(' ');
- scope.$apply(function() {
- scope.test = new Date(2011, 0, 1);
- });
+ it('should parse empty string to null', function() {
+ compileInput(' ');
- changeInputValueTo('');
- expect(scope.test).toBeNull();
- expect(inputElm).toBeValid();
+ scope.$apply(function() {
+ scope.test = new Date(2011, 0, 1);
});
+ changeInputValueTo('');
+ expect(scope.test).toBeNull();
+ expect(inputElm).toBeValid();
+ });
+
describe('min', function (){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- it('should invalidate', function (){
- changeInputValueTo('1999-12-31');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeFalsy();
- expect(scope.form.alias.$error.min).toBeTruthy();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('1999-12-31');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeFalsy();
+ expect(scope.form.alias.$error.min).toBeTruthy();
+ });
- it('should validate', function (){
- changeInputValueTo('2000-01-01');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2000, 0, 1));
- expect(scope.form.alias.$error.min).toBeFalsy();
- });
+ it('should validate', function (){
+ changeInputValueTo('2000-01-01');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2000, 0, 1));
+ expect(scope.form.alias.$error.min).toBeFalsy();
+ });
});
describe('max', function (){
- beforeEach(function (){
- compileInput(' ');
- scope.$digest();
- });
+ beforeEach(function (){
+ compileInput(' ');
+ scope.$digest();
+ });
- it('should invalidate', function (){
- changeInputValueTo('2019-12-31');
- expect(inputElm).toBeInvalid();
- expect(scope.value).toBeFalsy();
- expect(scope.form.alias.$error.max).toBeTruthy();
- });
+ it('should invalidate', function (){
+ changeInputValueTo('2019-12-31');
+ expect(inputElm).toBeInvalid();
+ expect(scope.value).toBeFalsy();
+ expect(scope.form.alias.$error.max).toBeTruthy();
+ });
- it('should validate', function() {
- changeInputValueTo('2000-01-01');
- expect(inputElm).toBeValid();
- expect(+scope.value).toBe(+new Date(2000, 0, 1));
- expect(scope.form.alias.$error.max).toBeFalsy();
- });
+ it('should validate', function() {
+ changeInputValueTo('2000-01-01');
+ expect(inputElm).toBeValid();
+ expect(+scope.value).toBe(+new Date(2000, 0, 1));
+ expect(scope.form.alias.$error.max).toBeFalsy();
+ });
});
it('should validate even if max value changes on-the-fly', function(done) {
@@ -1754,24 +1757,24 @@ describe('input', function() {
scope.max = '2001-01-01';
scope.$digest(function () {
- expect(inputElm).toBeValid();
- done();
+ expect(inputElm).toBeValid();
+ done();
});
});
it('should validate even if min value changes on-the-fly', function(done) {
- scope.min = '2013-01-01';
- compileInput(' ');
- scope.$digest();
+ scope.min = '2013-01-01';
+ compileInput(' ');
+ scope.$digest();
- changeInputValueTo('2010-01-01');
- expect(inputElm).toBeInvalid();
+ changeInputValueTo('2010-01-01');
+ expect(inputElm).toBeInvalid();
- scope.min = '2014-01-01';
- scope.$digest(function () {
- expect(inputElm).toBeValid();
- done();
- });
+ scope.min = '2014-01-01';
+ scope.$digest(function () {
+ expect(inputElm).toBeValid();
+ done();
+ });
});
});
@@ -1925,7 +1928,7 @@ describe('input', function() {
});
expect(inputElm).toBeValid();
- expect(inputElm.val()).toBe('0')
+ expect(inputElm.val()).toBe('0');
expect(scope.form.alias.$error.required).toBeFalsy();
});
@@ -1962,7 +1965,7 @@ describe('input', function() {
describe('EMAIL_REGEXP', function() {
-
+ /* global EMAIL_REGEXP: false */
it('should validate email', function() {
expect(EMAIL_REGEXP.test('a@b.com')).toBe(true);
expect(EMAIL_REGEXP.test('a@b.museum')).toBe(true);
@@ -1992,7 +1995,7 @@ describe('input', function() {
describe('URL_REGEXP', function() {
-
+ /* global URL_REGEXP: false */
it('should validate url', function() {
expect(URL_REGEXP.test('http://server:123/path')).toBe(true);
expect(URL_REGEXP.test('a@B.c')).toBe(false);
@@ -2507,7 +2510,7 @@ describe('NgModel animations', function() {
}
}
return animations;
- };
+ }
function assertValidAnimation(animation, event, className) {
expect(animation.event).toBe(event);
diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js
index 3b485ba24894..74de76d6555d 100644
--- a/test/ng/directive/ngClassSpec.js
+++ b/test/ng/directive/ngClassSpec.js
@@ -72,7 +72,8 @@ describe('ngClass', function() {
$rootScope.$digest();
expect(element.hasClass('A')).toBeFalsy();
expect(element.hasClass('B')).toBeTruthy();
- }));
+ })
+ );
it('should support adding multiple classes via a space delimited string', inject(function($rootScope, $compile) {
@@ -203,7 +204,8 @@ describe('ngClass', function() {
expect(e1.hasClass('odd')).toBeTruthy();
expect(e2.hasClass('same')).toBeTruthy();
expect(e2.hasClass('odd')).toBeTruthy();
- }));
+ })
+ );
it('should allow both ngClass and ngClassOdd/Even with multiple classes', inject(function($rootScope, $compile) {
element = $compile('' +
diff --git a/test/ng/directive/ngControllerSpec.js b/test/ng/directive/ngControllerSpec.js
index 9f6d343e6f2d..b604d443541e 100644
--- a/test/ng/directive/ngControllerSpec.js
+++ b/test/ng/directive/ngControllerSpec.js
@@ -35,7 +35,7 @@ describe('ngController', function() {
$window.Public = function() {
this.mark = 'works';
- }
+ };
}));
afterEach(function() {
diff --git a/test/ng/directive/ngIfSpec.js b/test/ng/directive/ngIfSpec.js
index 771e264a9a73..65c6733ee202 100755
--- a/test/ng/directive/ngIfSpec.js
+++ b/test/ng/directive/ngIfSpec.js
@@ -204,8 +204,8 @@ describe('ngIf and transcludes', function() {
describe('ngIf animations', function () {
var body, element, $rootElement;
- function html(html) {
- $rootElement.html(html);
+ function html(content) {
+ $rootElement.html(content);
element = $rootElement.children().eq(0);
return element;
}
@@ -250,7 +250,8 @@ describe('ngIf animations', function () {
expect(item.element.text()).toBe('Hi');
expect(element.children().length).toBe(1);
- }));
+ })
+ );
it('should fire off the leave animation',
inject(function ($compile, $rootScope, $animate) {
@@ -275,7 +276,8 @@ describe('ngIf animations', function () {
expect(item.element.text()).toBe('Hi');
expect(element.children().length).toBe(0);
- }));
+ })
+ );
it('should destroy the previous leave animation if a new one takes place', function() {
module(function($provide) {
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index 510fa38a230d..bf65a68f5e6b 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -112,7 +112,7 @@ describe('ngInclude', function() {
it('should fire $includeContentRequested event on scope after making the xhr call', inject(
function ($rootScope, $compile, $httpBackend) {
var contentRequestedSpy = jasmine.createSpy('content requested').andCallFake(function (event) {
- expect(event.targetScope).toBe($rootScope);
+ expect(event.targetScope).toBe($rootScope);
});
$httpBackend.whenGET('url').respond('my partial');
@@ -233,7 +233,8 @@ describe('ngInclude', function() {
var called = 0;
// we want to assert only during first watch
$rootScope.$watch(function() {
- if (!called++) expect(element.text()).toBe('');
+ if (!called) expect(element.text()).toBe('');
+ called++;
});
$rootScope.$digest();
@@ -249,7 +250,7 @@ describe('ngInclude', function() {
$rootScope.templateUrl = 'myUrl1';
$rootScope.logger = function(msg) {
log[msg] = true;
- }
+ };
$compile(element)($rootScope);
expect(log).toEqual({});
@@ -460,7 +461,8 @@ describe('ngInclude', function() {
$animate.triggerCallbacks();
expect(autoScrollSpy).toHaveBeenCalledOnce();
- }));
+ }
+ ));
});
});
@@ -569,8 +571,8 @@ describe('ngInclude and transcludes', function() {
describe('ngInclude animations', function() {
var body, element, $rootElement;
- function html(html) {
- $rootElement.html(html);
+ function html(content) {
+ $rootElement.html(content);
element = $rootElement.children().eq(0);
return element;
}
@@ -611,7 +613,8 @@ describe('ngInclude animations', function() {
var animation = $animate.queue.pop();
expect(animation.event).toBe('enter');
expect(animation.element.text()).toBe('data');
- }));
+ })
+ );
it('should fire off the leave animation',
inject(function($compile, $rootScope, $templateCache, $animate) {
@@ -635,7 +638,8 @@ describe('ngInclude animations', function() {
animation = $animate.queue.shift();
expect(animation.event).toBe('leave');
expect(animation.element.text()).toBe('data');
- }));
+ })
+ );
it('should animate two separate ngInclude elements',
inject(function($compile, $rootScope, $templateCache, $animate) {
@@ -661,7 +665,8 @@ describe('ngInclude animations', function() {
expect(itemA.attr('ng-include')).toBe('tpl');
expect(itemB.attr('ng-include')).toBe('tpl');
expect(itemA).not.toEqual(itemB);
- }));
+ })
+ );
it('should destroy the previous leave animation if a new one takes place', function() {
module(function($provide) {
diff --git a/test/ng/directive/ngPluralizeSpec.js b/test/ng/directive/ngPluralizeSpec.js
index 4d596efd0fa6..c0792dd67398 100644
--- a/test/ng/directive/ngPluralizeSpec.js
+++ b/test/ng/directive/ngPluralizeSpec.js
@@ -240,6 +240,6 @@ describe('ngPluralize', function() {
expect(element.text()).toBe('Igor and 2 other people are viewing.');
expect(elementAlt.text()).toBe('Igor and 2 other people are viewing.');
});
- })
+ });
});
});
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js
index 4a257ae9c2ab..e267e0e9b029 100644
--- a/test/ng/directive/ngRepeatSpec.js
+++ b/test/ng/directive/ngRepeatSpec.js
@@ -79,6 +79,7 @@ describe('ngRepeat', function() {
});
it('should iterate over an array-like class', function() {
+ /* jshint -W009 */
function Collection() {}
Collection.prototype = new Array();
Collection.prototype.length = 0;
@@ -395,10 +396,10 @@ describe('ngRepeat', function() {
it("should throw error when left-hand-side of ngRepeat can't be parsed", function() {
- element = jqLite('');
- $compile(element)(scope);
+ element = jqLite('');
+ $compile(element)(scope);
expect($exceptionHandler.errors.shift()[0].message).
- toMatch(/^\[ngRepeat:iidexp\] '_item_' in '_item_ in _collection_' should be an identifier or '\(_key_, _value_\)' expression, but got 'i dont parse'\./);
+ toMatch(/^\[ngRepeat:iidexp\] '_item_' in '_item_ in _collection_' should be an identifier or '\(_key_, _value_\)' expression, but got 'i dont parse'\./);
});
@@ -818,7 +819,7 @@ describe('ngRepeat', function() {
expect(children[1].nextSibling.nodeValue).toBe(' end ngRepeat: val in values ');
expect(children[2].nextSibling.nodeType).toBe(8);
expect(children[2].nextSibling.nodeValue).toBe(' end ngRepeat: val in values ');
- }
+ };
$rootScope.values = [1, 2, 3];
@@ -1045,7 +1046,7 @@ describe('ngRepeat', function() {
inject(function($compile, $rootScope) {
element = $compile('')($rootScope);
$rootScope.$digest();
- expect(element.text()).toBe('[[1]][[2]]')
+ expect(element.text()).toBe('[[1]][[2]]');
});
});
@@ -1143,8 +1144,8 @@ describe('ngRepeat and transcludes', function() {
describe('ngRepeat animations', function() {
var body, element, $rootElement;
- function html(html) {
- $rootElement.html(html);
+ function html(content) {
+ $rootElement.html(content);
element = $rootElement.children().eq(0);
return element;
}
@@ -1268,6 +1269,7 @@ describe('ngRepeat animations', function() {
item = $animate.queue.shift();
expect(item.event).toBe('move');
expect(item.element.text()).toBe('3');
- }));
+ })
+ );
});
diff --git a/test/ng/directive/ngShowHideSpec.js b/test/ng/directive/ngShowHideSpec.js
index 4bbbbb789006..f1a1986af5f5 100644
--- a/test/ng/directive/ngShowHideSpec.js
+++ b/test/ng/directive/ngShowHideSpec.js
@@ -55,9 +55,9 @@ describe('ngShow / ngHide', function() {
describe('ngShow / ngHide animations', function() {
var body, element, $rootElement;
- function html(html) {
+ function html(content) {
body.append($rootElement);
- $rootElement.html(html);
+ $rootElement.html(content);
element = $rootElement.children().eq(0);
return element;
}
diff --git a/test/ng/directive/ngSrcSpec.js b/test/ng/directive/ngSrcSpec.js
index 3dc00257b66c..8f21d6e941b3 100644
--- a/test/ng/directive/ngSrcSpec.js
+++ b/test/ng/directive/ngSrcSpec.js
@@ -1,3 +1,4 @@
+/*jshint scripturl:true*/
'use strict';
describe('ngSrc', function() {
@@ -26,7 +27,7 @@ describe('ngSrc', function() {
it('should error on src attributes for a different domain', inject(function($compile, $rootScope) {
element = $compile('')($rootScope);
$rootScope.testUrl = "http://a.different.domain.example.com";
- expect(function() { $rootScope.$apply() }).toThrowMinErr(
+ expect(function() { $rootScope.$apply(); }).toThrowMinErr(
"$interpolate", "interr", "Can't interpolate: {{testUrl}}\nError: [$sce:insecurl] Blocked " +
"loading resource from url not allowed by $sceDelegate policy. URL: " +
"http://a.different.domain.example.com");
@@ -35,7 +36,7 @@ describe('ngSrc', function() {
it('should error on JS src attributes', inject(function($compile, $rootScope) {
element = $compile('')($rootScope);
$rootScope.testUrl = "javascript:alert(1);";
- expect(function() { $rootScope.$apply() }).toThrowMinErr(
+ expect(function() { $rootScope.$apply(); }).toThrowMinErr(
"$interpolate", "interr", "Can't interpolate: {{testUrl}}\nError: [$sce:insecurl] Blocked " +
"loading resource from url not allowed by $sceDelegate policy. URL: " +
"javascript:alert(1);");
diff --git a/test/ng/directive/ngSwitchSpec.js b/test/ng/directive/ngSwitchSpec.js
index 2b771a0c951c..60193adcde2e 100644
--- a/test/ng/directive/ngSwitchSpec.js
+++ b/test/ng/directive/ngSwitchSpec.js
@@ -217,8 +217,8 @@ describe('ngSwitch', function() {
describe('ngSwitch animations', function() {
var body, element, $rootElement;
- function html(html) {
- $rootElement.html(html);
+ function html(content) {
+ $rootElement.html(content);
element = $rootElement.children().eq(0);
return element;
}
@@ -258,7 +258,8 @@ describe('ngSwitch animations', function() {
item = $animate.queue.shift();
expect(item.event).toBe('enter');
expect(item.element.text()).toBe('one');
- }));
+ })
+ );
it('should fire off the leave animation',
@@ -291,7 +292,8 @@ describe('ngSwitch animations', function() {
item = $animate.queue.shift();
expect(item.event).toBe('enter');
expect(item.element.text()).toBe('three');
- }));
+ })
+ );
it('should destroy the previous leave animation if a new one takes place', function() {
module(function($provide) {
diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js
index d270f438704f..0912c5f36184 100644
--- a/test/ng/directive/selectSpec.js
+++ b/test/ng/directive/selectSpec.js
@@ -218,7 +218,7 @@ describe('select', function() {
it('should not break if both the select and repeater models change at once', function() {
scope.robots = ['c3p0', 'r2d2'];
- scope.robot = 'c3p0'
+ scope.robot = 'c3p0';
compile('' +
'--select-- ' +
'{{r}} ' +
@@ -1206,7 +1206,7 @@ describe('select', function() {
it('should deselect all options when model is emptied', function() {
createMultiSelect();
- scope.$apply(function() {
+ scope.$apply(function() {
scope.values = [{name: 'A'}, {name: 'B'}];
scope.selected = [scope.values[0]];
});
@@ -1217,7 +1217,7 @@ describe('select', function() {
});
expect(element.find('option')[0].selected).toEqual(false);
- })
+ });
});
@@ -1325,7 +1325,7 @@ describe('select', function() {
});
it('should set value even if self closing HTML', function() {
- scope.x = 'hello'
+ scope.x = 'hello';
compile('hello ');
expect(element).toEqualSelect(['hello']);
});
diff --git a/test/ng/exceptionHandlerSpec.js b/test/ng/exceptionHandlerSpec.js
index 3f3dd8003884..9ef0af3ebf36 100644
--- a/test/ng/exceptionHandlerSpec.js
+++ b/test/ng/exceptionHandlerSpec.js
@@ -1,24 +1,25 @@
'use strict';
describe('$exceptionHandler', function() {
- it('should log errors with single argument', function() {
- module(function($provide){
- $provide.provider('$exceptionHandler', $ExceptionHandlerProvider);
- });
- inject(function($log, $exceptionHandler) {
- $exceptionHandler('myError');
- expect($log.error.logs.shift()).toEqual(['myError']);
- });
+ /* global $ExceptionHandlerProvider:false */
+ it('should log errors with single argument', function() {
+ module(function($provide){
+ $provide.provider('$exceptionHandler', $ExceptionHandlerProvider);
});
+ inject(function($log, $exceptionHandler) {
+ $exceptionHandler('myError');
+ expect($log.error.logs.shift()).toEqual(['myError']);
+ });
+ });
- it('should log errors with multiple arguments', function() {
- module(function($provide){
- $provide.provider('$exceptionHandler', $ExceptionHandlerProvider);
- });
- inject(function($log, $exceptionHandler) {
- $exceptionHandler('myError', 'comment');
- expect($log.error.logs.shift()).toEqual(['myError', 'comment']);
- });
+ it('should log errors with multiple arguments', function() {
+ module(function($provide){
+ $provide.provider('$exceptionHandler', $ExceptionHandlerProvider);
+ });
+ inject(function($log, $exceptionHandler) {
+ $exceptionHandler('myError', 'comment');
+ expect($log.error.logs.shift()).toEqual(['myError', 'comment']);
});
+ });
});
diff --git a/test/ng/filter/filterSpec.js b/test/ng/filter/filterSpec.js
index 7679136ac9f9..fecfcf78b0c8 100644
--- a/test/ng/filter/filterSpec.js
+++ b/test/ng/filter/filterSpec.js
@@ -77,7 +77,8 @@ describe('Filter: filter', function() {
{person: {name: 'Joan'}}];
expect(filter(items, {person: {name: 'Jo'}}).length).toBe(2);
expect(filter(items, {person: {name: 'Jo'}})).toEqual([
- {person: {name: 'John'}}, {person: {name: 'Joan'}}]);
+ {person: {name: 'John'}}, {person: {name: 'Joan'}}
+ ]);
});
@@ -94,8 +95,8 @@ describe('Filter: filter', function() {
it('should support boolean properties', function() {
var items = [{name: 'tom', current: true},
- {name: 'demi', current: false},
- {name: 'sofia'}];
+ {name: 'demi', current: false},
+ {name: 'sofia'}];
expect(filter(items, {current:true}).length).toBe(1);
expect(filter(items, {current:true})[0].name).toBe('tom');
@@ -118,26 +119,26 @@ describe('Filter: filter', function() {
expect(filter(items, expr, true)).toEqual([items[1]]);
expect(filter(items, expr, false)).toEqual([items[1], items[2]]);
- var items = [
+ items = [
{key: 'value1', nonkey: 1},
{key: 'value2', nonkey: 2},
{key: 'value12', nonkey: 3},
{key: 'value1', nonkey:4},
{key: 'Value1', nonkey:5}
];
- var expr = {key: 'value1'};
+ expr = {key: 'value1'};
expect(filter(items, expr, true)).toEqual([items[0], items[3]]);
- var items = [
+ items = [
{key: 1, nonkey: 1},
{key: 2, nonkey: 2},
{key: 12, nonkey: 3},
{key: 1, nonkey:4}
];
- var expr = { key: 1 };
+ expr = { key: 1 };
expect(filter(items, expr, true)).toEqual([items[0], items[3]]);
- var expr = 12;
+ expr = 12;
expect(filter(items, expr, true)).toEqual([items[2]]);
});
@@ -151,7 +152,7 @@ describe('Filter: filter', function() {
var expr = {key: 10};
var comparator = function (obj,value) {
return obj > value;
- }
+ };
expect(filter(items, expr, comparator)).toEqual([items[2]]);
expr = 10;
diff --git a/test/ng/filter/filtersSpec.js b/test/ng/filter/filtersSpec.js
index efe12e056d46..b4432316ee8b 100644
--- a/test/ng/filter/filtersSpec.js
+++ b/test/ng/filter/filtersSpec.js
@@ -19,6 +19,7 @@ describe('filters', function() {
});
describe('formatNumber', function() {
+ /* global formatNumber: false */
var pattern;
beforeEach(function() {
@@ -68,18 +69,18 @@ describe('filters', function() {
expect(num).toBe('123.100');
num = formatNumber(123.12, pattern, ',', '.');
expect(num).toBe('123.12');
- var num = formatNumber(123.1116, pattern, ',', '.');
+ num = formatNumber(123.1116, pattern, ',', '.');
expect(num).toBe('123.112');
});
it('should format the same with string as well as numeric fractionSize', function(){
var num = formatNumber(123.1, pattern, ',', '.', "0");
expect(num).toBe('123');
- var num = formatNumber(123.1, pattern, ',', '.', 0);
+ num = formatNumber(123.1, pattern, ',', '.', 0);
expect(num).toBe('123');
- var num = formatNumber(123.1, pattern, ',', '.', "3");
+ num = formatNumber(123.1, pattern, ',', '.', "3");
expect(num).toBe('123.100');
- var num = formatNumber(123.1, pattern, ',', '.', 3);
+ num = formatNumber(123.1, pattern, ',', '.', 3);
expect(num).toBe('123.100');
});
});
@@ -121,6 +122,7 @@ describe('filters', function() {
it('should do basic filter', function() {
+ /* jshint -W008 */
expect(number(0, 0)).toEqual('0');
expect(number(-999)).toEqual('-999');
expect(number(123)).toEqual('123');
@@ -273,19 +275,19 @@ describe('filters', function() {
var westOfUTCPartial = new angular.mock.TzDate(+5.5, '2010-09-03T12:05:08.000Z');
expect(date(utc, "yyyy-MM-ddTHH:mm:ssZ")).
- toEqual('2010-09-03T12:05:08+0000')
+ toEqual('2010-09-03T12:05:08+0000');
expect(date(eastOfUTC, "yyyy-MM-ddTHH:mm:ssZ")).
- toEqual('2010-09-03T17:05:08+0500')
+ toEqual('2010-09-03T17:05:08+0500');
expect(date(westOfUTC, "yyyy-MM-ddTHH:mm:ssZ")).
- toEqual('2010-09-03T07:05:08-0500')
+ toEqual('2010-09-03T07:05:08-0500');
expect(date(eastOfUTCPartial, "yyyy-MM-ddTHH:mm:ssZ")).
- toEqual('2010-09-03T17:35:08+0530')
+ toEqual('2010-09-03T17:35:08+0530');
expect(date(westOfUTCPartial, "yyyy-MM-ddTHH:mm:ssZ")).
- toEqual('2010-09-03T06:35:08-0530')
+ toEqual('2010-09-03T06:35:08-0530');
});
it('should treat single quoted strings as string literals', function() {
diff --git a/test/ng/filter/limitToSpec.js b/test/ng/filter/limitToSpec.js
index f938a28ae23e..0e23d42ec600 100644
--- a/test/ng/filter/limitToSpec.js
+++ b/test/ng/filter/limitToSpec.js
@@ -2,7 +2,7 @@
describe('Filter: limitTo', function() {
var items;
- var str
+ var str;
var limitTo;
beforeEach(inject(function($filter) {
@@ -67,7 +67,7 @@ describe('Filter: limitTo', function() {
expect(limitTo(str, '9')).toEqual(str);
expect(limitTo(str, -9)).toEqual(str);
expect(limitTo(str, '-9')).toEqual(str);
- })
+ });
it('should return entire input array when limited by Infinity', function() {
expect(limitTo(items, Infinity)).toEqual(items);
diff --git a/test/ng/filter/orderBySpec.js b/test/ng/filter/orderBySpec.js
index 5dc966777419..f7003d4b76e4 100644
--- a/test/ng/filter/orderBySpec.js
+++ b/test/ng/filter/orderBySpec.js
@@ -32,13 +32,15 @@ describe('Filter: orderBy', function() {
});
it('should support string predicates with names containing non-identifier characters', function() {
+ /*jshint -W008 */
expect(orderBy([{"Tip %": .25}, {"Tip %": .15}, {"Tip %": .40}], '"Tip %"'))
.toEqualData([{"Tip %": .15}, {"Tip %": .25}, {"Tip %": .40}]);
expect(orderBy([{"원": 76000}, {"원": 31000}, {"원": 156000}], '"원"'))
- .toEqualData([{"원": 31000}, {"원": 76000}, {"원": 156000}])
+ .toEqualData([{"원": 31000}, {"원": 76000}, {"원": 156000}]);
});
it('should throw if quoted string predicate is quoted incorrectly', function() {
+ /*jshint -W008 */
expect(function() {
return orderBy([{"Tip %": .15}, {"Tip %": .25}, {"Tip %": .40}], '"Tip %\'');
}).toThrow();
diff --git a/test/ng/filterSpec.js b/test/ng/filterSpec.js
index fc0571cb0683..eca98747f088 100644
--- a/test/ng/filterSpec.js
+++ b/test/ng/filterSpec.js
@@ -44,4 +44,4 @@ describe('$filter', function() {
expect(barFilter()).toBe('bar');
});
});
-});
\ No newline at end of file
+});
diff --git a/test/ng/httpBackendSpec.js b/test/ng/httpBackendSpec.js
index a179a7fd8f7c..9aed1578f395 100644
--- a/test/ng/httpBackendSpec.js
+++ b/test/ng/httpBackendSpec.js
@@ -1,3 +1,6 @@
+/* global createHttpBackend: false, createMockXhr: false, MockXhr: false */
+'use strict';
+
describe('$httpBackend', function() {
var $backend, $browser, callbacks,
@@ -279,7 +282,7 @@ describe('$httpBackend', function() {
expect(response).toBe('response');
});
- $backend = createHttpBackend($browser, function() { return new SyncXhr() });
+ $backend = createHttpBackend($browser, function() { return new SyncXhr(); });
$backend('GET', '/url', null, callback);
expect(callback).toHaveBeenCalledOnce();
});
@@ -460,6 +463,7 @@ describe('$httpBackend', function() {
});
it('should convert 0 to 404 if no content - relative url', function() {
+ /* global urlParsingNode: true */
var originalUrlParsingNode = urlParsingNode;
//temporarily overriding the DOM element to pretend that the test runs origin with file:// protocol
diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js
index 14ac8433437f..f93b2d1a484e 100644
--- a/test/ng/httpSpec.js
+++ b/test/ng/httpSpec.js
@@ -9,12 +9,12 @@ describe('$http', function() {
});
beforeEach(module(function($exceptionHandlerProvider) {
- $exceptionHandlerProvider.mode('log');
+ $exceptionHandlerProvider.mode('log');
}));
afterEach(inject(function($exceptionHandler, $httpBackend, $rootScope) {
forEach($exceptionHandler.errors, function(e) {
- dump('Unhandled exception: ', e)
+ dump('Unhandled exception: ', e);
});
if ($exceptionHandler.errors.length) {
@@ -28,7 +28,7 @@ describe('$http', function() {
describe('$httpProvider', function() {
describe('interceptors', function() {
- it('should accept injected rejected response interceptor', function() {
+ it('should accept injected rejected response interceptor', function() {
var wasCalled = false;
module(function($httpProvider, $provide) {
$httpProvider.responseInterceptors.push('injectedInterceptor');
@@ -83,7 +83,7 @@ describe('$http', function() {
return {
response: function(response) {
response.data += ':1';
- savedResponse = response
+ savedResponse = response;
return $q.reject(':2');
}
};
@@ -194,7 +194,7 @@ describe('$http', function() {
response.data += '!';
return response;
});
- }
+ };
});
// return a new resolved promise representing modified response object
@@ -221,7 +221,7 @@ describe('$http', function() {
response.data = uppercase(response.data);
return response;
});
- }
+ };
});
$httpProvider.responseInterceptors.push('myInterceptor');
});
@@ -344,7 +344,7 @@ describe('$http', function() {
$rootScope.$apply();
expect(config.method).toEqual('get');
expect(config.url).toEqual('/url');
- expect(config.headers.foo).toEqual('bar')
+ expect(config.headers.foo).toEqual('bar');
});
});
@@ -442,8 +442,8 @@ describe('$http', function() {
it('should expand arrays in params map', inject(function($httpBackend, $http) {
- $httpBackend.expect('GET', '/url?a=1&a=2&a=3').respond('');
- $http({url: '/url', params: {a: [1,2,3]}, method: 'GET'});
+ $httpBackend.expect('GET', '/url?a=1&a=2&a=3').respond('');
+ $http({url: '/url', params: {a: [1,2,3]}, method: 'GET'});
}));
@@ -460,7 +460,7 @@ describe('$http', function() {
it('should not add question mark when params is empty', function() {
$httpBackend.expect('GET', '/url').respond('');
$http({url: '/url', params: {}, method: 'GET'});
- })
+ });
});
@@ -591,7 +591,7 @@ describe('$http', function() {
expect(r.headers('nothing')).toBe(null);
});
- $http({url: '/url', method: 'GET'}).then(callback)
+ $http({url: '/url', method: 'GET'}).then(callback);
$httpBackend.flush();
expect(callback).toHaveBeenCalledOnce();
@@ -629,6 +629,7 @@ describe('$http', function() {
describe('response headers parser', function() {
+ /* global parseHeaders: false */
it('should parse basic', function() {
var parsed = parseHeaders(
@@ -833,8 +834,8 @@ describe('$http', function() {
$http({url: '/url', method: 'POST', headers: {'S-ome': 'Header'}});
$http({url: '/url', method: 'PUT', headers: {'Another': 'Header'}});
$http({url: '/url', method: 'DELETE', headers: {}});
- $http({url: '/url', method: 'GET', xsrfHeaderName: 'aHeader'})
- $http({url: '/url', method: 'GET', xsrfCookieName: 'aCookie'})
+ $http({url: '/url', method: 'GET', xsrfHeaderName: 'aHeader'});
+ $http({url: '/url', method: 'GET', xsrfCookieName: 'aCookie'});
$httpBackend.flush();
}));
@@ -1038,8 +1039,8 @@ describe('$http', function() {
it('should pipeline more functions', function() {
- function first(d, h) {return d + '-first' + ':' + h('h1')}
- function second(d) {return uppercase(d)}
+ function first(d, h) {return d + '-first' + ':' + h('h1');}
+ function second(d) {return uppercase(d);}
$httpBackend.expect('POST', '/url', 'REQ-FIRST:V1').respond(200);
$http.post('/url', 'req', {
@@ -1123,8 +1124,8 @@ describe('$http', function() {
it('should pipeline more functions', function() {
- function first(d, h) {return d + '-first' + ':' + h('h1')}
- function second(d) {return uppercase(d)}
+ function first(d, h) {return d + '-first' + ':' + h('h1');}
+ function second(d) {return uppercase(d);}
$httpBackend.expect('POST', '/url').respond(200, 'resp', {h1: 'v1'});
$http.post('/url', '', {transformResponse: [first, second]}).success(callback);
@@ -1333,7 +1334,7 @@ describe('$http', function() {
describe('$http.defaults.cache', function () {
it('should be undefined by default', function() {
- expect($http.defaults.cache).toBeUndefined()
+ expect($http.defaults.cache).toBeUndefined();
});
it('should cache requests when no cache given in request config', function() {
@@ -1497,7 +1498,7 @@ describe('$http', function() {
expect($http.defaults.headers.post).not.toBe($http.defaults.headers.put);
expect($http.defaults.headers.post).not.toBe($http.defaults.headers.patch);
expect($http.defaults.headers.put).not.toBe($http.defaults.headers.patch);
- })
+ });
});
});
@@ -1517,7 +1518,11 @@ describe('$http', function() {
inject(function($http, $rootScope) {
$http({
- method: 'GET', url: 'some.html', timeout: 12345, withCredentials: true, responseType: 'json'
+ method: 'GET',
+ url: 'some.html',
+ timeout: 12345,
+ withCredentials: true,
+ responseType: 'json'
});
$rootScope.$digest();
expect($httpBackend).toHaveBeenCalledOnce();
@@ -1541,7 +1546,10 @@ describe('$http', function() {
inject(function($http, $rootScope) {
$http.defaults.withCredentials = true;
$http({
- method: 'GET', url: 'some.html', timeout: 12345, responseType: 'json'
+ method: 'GET',
+ url: 'some.html',
+ timeout: 12345,
+ responseType: 'json'
});
$rootScope.$digest();
expect($httpBackend).toHaveBeenCalledOnce();
diff --git a/test/ng/intervalSpec.js b/test/ng/intervalSpec.js
index 59f62d9621ca..0d101246ebf7 100644
--- a/test/ng/intervalSpec.js
+++ b/test/ng/intervalSpec.js
@@ -1,6 +1,7 @@
'use strict';
describe('$interval', function() {
+ /* global $IntervalProvider: false */
beforeEach(module(function($provide){
var repeatFns = [],
@@ -58,7 +59,7 @@ describe('$interval', function() {
expect(counter).toBe(0);
- $window.flush(1000)
+ $window.flush(1000);
expect(counter).toBe(1);
$window.flush(1000);
@@ -113,7 +114,7 @@ describe('$interval', function() {
it('should allow you to specify a number of iterations', inject(function($interval, $window) {
var counter = 0;
- $interval(function() {counter++}, 1000, 2);
+ $interval(function() {counter++;}, 1000, 2);
$window.flush(1000);
expect(counter).toBe(1);
@@ -157,7 +158,8 @@ describe('$interval', function() {
$window.flush(1000);
expect(log).toEqual([
- 'tick', 'promise update: 0', 'tick', 'promise update: 1', 'promise success: 2']);
+ 'tick', 'promise update: 0', 'tick', 'promise update: 1', 'promise success: 2'
+ ]);
}));
diff --git a/test/ng/localeSpec.js b/test/ng/localeSpec.js
index 83c4eceefa87..1da9cf611062 100644
--- a/test/ng/localeSpec.js
+++ b/test/ng/localeSpec.js
@@ -1,6 +1,7 @@
'use strict';
describe('$locale', function() {
+ /* global $LocaleProvider: false */
var $locale = new $LocaleProvider().$get();
diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js
index 979993156880..3c36c8a11274 100644
--- a/test/ng/locationSpec.js
+++ b/test/ng/locationSpec.js
@@ -1,6 +1,6 @@
+/* global LocationHashbangUrl: false, LocationHtml5Url: false */
'use strict';
-
describe('$location', function() {
var url;
@@ -14,6 +14,7 @@ describe('$location', function() {
describe('File Protocol', function () {
+ /* global urlParsingNode: true */
var urlParsingNodePlaceholder;
beforeEach(inject(function ($sniffer) {
@@ -221,7 +222,7 @@ describe('$location', function() {
it('should set path to forward-slash when empty', function() {
url = new LocationHtml5Url('http://server/');
- url.$$parse('http://server/')
+ url.$$parse('http://server/');
expect(url.path()).toBe('/');
expect(url.absUrl()).toBe('http://server/');
});
@@ -437,28 +438,28 @@ describe('$location', function() {
it('should return decoded characters for search specified with setter', function() {
var locationUrl = new LocationHtml5Url('http://host.com/');
- locationUrl.$$parse('http://host.com/')
+ locationUrl.$$parse('http://host.com/');
locationUrl.search('q', '1/2 3');
expect(locationUrl.search()).toEqual({'q': '1/2 3'});
});
it('should return an array for duplicate params', function() {
var locationUrl = new LocationHtml5Url('http://host.com');
- locationUrl.$$parse('http://host.com')
+ locationUrl.$$parse('http://host.com');
locationUrl.search('q', ['1/2 3','4/5 6']);
expect(locationUrl.search()).toEqual({'q': ['1/2 3','4/5 6']});
});
it('should encode an array correctly from search and add to url', function() {
var locationUrl = new LocationHtml5Url('http://host.com');
- locationUrl.$$parse('http://host.com')
+ locationUrl.$$parse('http://host.com');
locationUrl.search({'q': ['1/2 3','4/5 6']});
expect(locationUrl.absUrl()).toEqual('http://host.com?q=1%2F2%203&q=4%2F5%206');
});
it('should rewrite params when specifing a single param in search', function() {
var locationUrl = new LocationHtml5Url('http://host.com');
- locationUrl.$$parse('http://host.com')
+ locationUrl.$$parse('http://host.com');
locationUrl.search({'q': '1/2 3'});
expect(locationUrl.absUrl()).toEqual('http://host.com?q=1%2F2%203');
locationUrl.search({'q': '4/5 6'});
@@ -747,7 +748,7 @@ describe('$location', function() {
});
describe('PATH_MATCH', function() {
-
+ /* global PATH_MATCH: false */
it('should parse just path', function() {
var match = PATH_MATCH.exec('/path');
expect(match[1]).toBe('/path');
@@ -1120,7 +1121,7 @@ describe('$location', function() {
// don't run next tests on IE<9, as browserTrigger does not simulate pressed keys
- if (!(msie < 9)) {
+ if (!msie || msie >= 9) {
it('should not rewrite when clicked with ctrl pressed', function() {
configureService('/a?b=c', true, true);
@@ -1154,10 +1155,10 @@ describe('$location', function() {
module(function() {
return function($browser) {
window.location.hash = 'someHash';
- base = window.location.href
+ base = window.location.href;
$browser.url(base);
base = base.split('#')[0];
- }
+ };
});
inject(function($rootScope, $compile, $browser, $rootElement, $document, $location) {
// we need to do this otherwise we can't simulate events
@@ -1189,7 +1190,7 @@ describe('$location', function() {
$browser.url(base = window.location.href);
base = base.split('#')[0];
$locationProvider.hashPrefix('!');
- }
+ };
});
inject(function($rootScope, $compile, $browser, $rootElement, $document, $location) {
// we need to do this otherwise we can't simulate events
@@ -1222,7 +1223,7 @@ describe('$location', function() {
});
return function($browser) {
$browser.url(base = 'http://server/');
- }
+ };
});
inject(function($location) {
// make IE happy
@@ -1252,7 +1253,7 @@ describe('$location', function() {
});
return function($browser) {
$browser.url(base = 'http://server/');
- }
+ };
});
inject(function($rootScope, $compile, $browser, $rootElement, $document, $location) {
// make IE happy
@@ -1293,7 +1294,7 @@ describe('$location', function() {
$browser.url(base = window.location.href);
base = base.split('#')[0];
$locationProvider.hashPrefix('!');
- }
+ };
});
inject(function($rootScope, $compile, $browser, $rootElement, $document, $location) {
// we need to do this otherwise we can't simulate events
@@ -1348,7 +1349,7 @@ describe('$location', function() {
event.preventDefault();
});
$rootScope.$on('$locationChangeSuccess', function(event, newUrl, oldUrl) {
- throw Error('location should have been canceled');
+ throw new Error('location should have been canceled');
});
expect($location.url()).toEqual('');
@@ -1398,7 +1399,7 @@ describe('$location', function() {
$rootElement.html('link ');
$compile($rootElement)($rootScope);
jqLite(document.body).append($rootElement);
- }
+ };
});
inject(function($location, $rootScope, $browser, $rootElement) {
@@ -1431,7 +1432,7 @@ describe('$location', function() {
$rootElement.html('link ');
$compile($rootElement)($rootScope);
jqLite(document.body).append($rootElement);
- }
+ };
});
inject(function($location, $rootScope, $browser, $rootElement) {
@@ -1507,6 +1508,7 @@ describe('$location', function() {
var location;
it('should rewrite URL', function() {
+ /* jshint scripturl: true */
location = new LocationHashbangUrl('http://server/pre/', '#');
expect(location.$$rewrite('http://other')).toEqual(undefined);
@@ -1518,7 +1520,7 @@ describe('$location', function() {
it("should not set hash if one was not originally specified", function() {
location = new LocationHashbangUrl('http://server/pre/index.html', '#');
- location.$$parse('http://server/pre/index.html')
+ location.$$parse('http://server/pre/index.html');
expect(location.url()).toBe('');
expect(location.absUrl()).toBe('http://server/pre/index.html');
});
@@ -1526,7 +1528,7 @@ describe('$location', function() {
it("should parse hash if one was specified", function() {
location = new LocationHashbangUrl('http://server/pre/index.html', '#');
- location.$$parse('http://server/pre/index.html#/foo/bar')
+ location.$$parse('http://server/pre/index.html#/foo/bar');
expect(location.url()).toBe('/foo/bar');
expect(location.absUrl()).toBe('http://server/pre/index.html#/foo/bar');
});
@@ -1535,7 +1537,7 @@ describe('$location', function() {
it("should prefix hash url with / if one was originally missing", function() {
location = new LocationHashbangUrl('http://server/pre/index.html', '#');
- location.$$parse('http://server/pre/index.html#not-starting-with-slash')
+ location.$$parse('http://server/pre/index.html#not-starting-with-slash');
expect(location.url()).toBe('/not-starting-with-slash');
expect(location.absUrl()).toBe('http://server/pre/index.html#/not-starting-with-slash');
});
@@ -1553,6 +1555,7 @@ describe('$location', function() {
describe('LocationHashbangInHtml5Url', function() {
+ /* global LocationHashbangInHtml5Url: false */
var location, locationIndex;
beforeEach(function() {
diff --git a/test/ng/logSpec.js b/test/ng/logSpec.js
index 4cac5c5cba44..86d134bbdb74 100644
--- a/test/ng/logSpec.js
+++ b/test/ng/logSpec.js
@@ -1,3 +1,4 @@
+/* global $LogProvider: false */
'use strict';
function initService(debugEnabled) {
@@ -118,24 +119,24 @@ describe('$log', function() {
describe("$log.debug", function () {
- beforeEach(initService(false));
-
- it("should skip debugging output if disabled", inject(
- function(){
- $window.console = {log: log,
- warn: warn,
- info: info,
- error: error,
- debug: debug};
- },
- function($log) {
- $log.log();
- $log.warn();
- $log.info();
- $log.error();
- $log.debug();
- expect(logger).toEqual('log;warn;info;error;');
- }
+ beforeEach(initService(false));
+
+ it("should skip debugging output if disabled", inject(
+ function(){
+ $window.console = {log: log,
+ warn: warn,
+ info: info,
+ error: error,
+ debug: debug};
+ },
+ function($log) {
+ $log.log();
+ $log.warn();
+ $log.info();
+ $log.error();
+ $log.debug();
+ expect(logger).toEqual('log;warn;info;error;');
+ }
));
});
diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js
index cf6d639bb480..24766c687203 100644
--- a/test/ng/parseSpec.js
+++ b/test/ng/parseSpec.js
@@ -3,6 +3,7 @@
describe('parser', function() {
beforeEach(function() {
+ /* global getterFnCache: true, promiseWarningCache: true */
// clear caches
getterFnCache = {};
promiseWarningCache = {};
@@ -13,6 +14,7 @@ describe('parser', function() {
var lex;
beforeEach(function () {
+ /* global Lexer: false */
lex = function () {
var lexer = new Lexer({csp: false, unwrapPromises: false});
return lexer.lex.apply(lexer, arguments);
@@ -225,6 +227,7 @@ describe('parser', function() {
}));
it('should parse expressions', function() {
+ /*jshint -W006, -W007 */
expect(scope.$eval("-1")).toEqual(-1);
expect(scope.$eval("1 + 2.5")).toEqual(3.5);
expect(scope.$eval("1 + -2.5")).toEqual(-1.5);
@@ -235,6 +238,7 @@ describe('parser', function() {
});
it('should parse comparison', function() {
+ /* jshint -W041 */
expect(scope.$eval("false")).toBeFalsy();
expect(scope.$eval("!true")).toBeFalsy();
expect(scope.$eval("1==1")).toBeTruthy();
@@ -367,11 +371,11 @@ describe('parser', function() {
// Assign to x1 and build path 'x1.x2.x3. ... .x[n]' to access the final value.
scope.x1 = obj;
var path = 'x1';
- for (var i = 2; i <= pathLength; i++) {
+ for (i = 2; i <= pathLength; i++) {
path += '.x' + i;
}
expect(scope.$eval(path)).toBe(42);
- locals['x' + pathLength] = 'not 42'
+ locals['x' + pathLength] = 'not 42';
expect(scope.$eval(path, locals)).toBe(42);
});
});
@@ -444,7 +448,7 @@ describe('parser', function() {
it('should evaluate function call from a return value', function() {
scope.val = 33;
- scope.getter = function() { return function() { return this.val; }};
+ scope.getter = function() { return function() { return this.val; }; };
expect(scope.$eval("getter()()")).toBe(33);
});
@@ -580,6 +584,7 @@ describe('parser', function() {
});
it('should evaluate negation', function() {
+ /* jshint -W018 */
expect(scope.$eval("!false || true")).toEqual(!false || true);
expect(scope.$eval("!11 == 10")).toEqual(!11 == 10);
expect(scope.$eval("12/6/2")).toEqual(12/6/2);
@@ -824,12 +829,12 @@ describe('parser', function() {
// When not overridden, access should be restricted both by the dot operator and by the
// index operator.
expect(function() {
- scope.$eval('foo.constructor()', scope)
+ scope.$eval('foo.constructor()', scope);
}).toThrowMinErr(
'$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
'Expression: foo.constructor()');
expect(function() {
- scope.$eval('foo["constructor"]()', scope)
+ scope.$eval('foo["constructor"]()', scope);
}).toThrowMinErr(
'$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
'Expression: foo["constructor"]()');
@@ -840,7 +845,7 @@ describe('parser', function() {
};
// Dot operator should still block it.
expect(function() {
- scope.$eval('foo.constructor()', scope)
+ scope.$eval('foo.constructor()', scope);
}).toThrowMinErr(
'$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
'Expression: foo.constructor()');
diff --git a/test/ng/qSpec.js b/test/ng/qSpec.js
index 3d8a08ed5f63..a327a80714de 100644
--- a/test/ng/qSpec.js
+++ b/test/ng/qSpec.js
@@ -1,3 +1,4 @@
+/* global qFactory: false */
'use strict';
/**
@@ -72,7 +73,7 @@ describe('q', function() {
name = 'success' + (name || '');
return function() {
return _logInvocation(name, arguments, (returnValDefined ? returnVal : arguments[0]), throwReturnVal);
- }
+ };
}
/**
@@ -88,7 +89,7 @@ describe('q', function() {
name = 'finally' + (name || '');
return function() {
return _logInvocation(name, arguments, (returnValDefined ? returnVal : arguments[0]), throwReturnVal);
- }
+ };
}
/**
@@ -104,7 +105,7 @@ describe('q', function() {
name = 'progress' + (name || '');
return function() {
return _logInvocation(name, arguments, (returnValDefined ? returnVal : arguments[0]), throwReturnVal);
- }
+ };
}
/**
@@ -125,7 +126,7 @@ describe('q', function() {
} else {
return _logInvocation(name, arguments, returnVal, throwReturnVal);
}
- }
+ };
}
/** helper for synchronous resolution of deferred */
@@ -177,13 +178,13 @@ describe('q', function() {
});
}
}
- }
+ };
beforeEach(function() {
q = qFactory(mockNextTick.nextTick, noop),
defer = q.defer;
- deferred = defer()
+ deferred = defer();
promise = deferred.promise;
log = [];
mockNextTick.queue = [];
@@ -343,7 +344,7 @@ describe('q', function() {
expect(mockNextTick.queue.length).toBe(0);
expect(logStr()).toBe('');
- promise.then(success(2), error(2))
+ promise.then(success(2), error(2));
expect(logStr()).toBe('');
mockNextTick.flush();
expect(logStr()).toBe('success2(foo)->foo');
@@ -364,7 +365,7 @@ describe('q', function() {
expect(mockNextTick.queue.length).toBe(0);
expect(logStr()).toBe('');
- promise.then(success(2), error(2))
+ promise.then(success(2), error(2));
expect(logStr()).toBe('');
mockNextTick.flush();
expect(logStr()).toBe('error2(foo)->reject(foo)');
@@ -442,7 +443,7 @@ describe('q', function() {
log = [];
deferred.reject('bar');
deferred.resolve('baz');
- deferred.notify('qux')
+ deferred.notify('qux');
expect(mockNextTick.queue.length).toBe(0);
expect(logStr()).toBe('');
@@ -769,7 +770,7 @@ describe('q', function() {
it('should not take an argument',
function() {
- promise['finally'](fin(1))
+ promise['finally'](fin(1));
syncResolve(deferred, 'foo');
expect(logStr()).toBe('finally1()');
});
@@ -778,7 +779,7 @@ describe('q', function() {
it('should call the callback',
function() {
- promise.then(success(1))['finally'](fin(1))
+ promise.then(success(1))['finally'](fin(1));
syncResolve(deferred, 'foo');
expect(logStr()).toBe('success1(foo)->foo; finally1()');
});
@@ -800,7 +801,7 @@ describe('q', function() {
then(success('BB', 'bb'), error('BB'));
promise.then(success('C', 'c'), error('C'))['finally'](fin('CC', 'IGNORED'))
.then(success('CCC', 'cc'), error('CCC'))
- .then(success('CCCC', 'ccc'), error('CCCC'))
+ .then(success('CCCC', 'ccc'), error('CCCC'));
syncResolve(deferred, 'RESOLVED_VAL');
expect(log).toEqual(['successA(RESOLVED_VAL)->a',
@@ -822,7 +823,7 @@ describe('q', function() {
returnedDef.resolve('bar');
promise['finally'](fin(1, returnedDef.promise))
- .then(success(2))
+ .then(success(2));
syncResolve(deferred, 'foo');
@@ -833,10 +834,10 @@ describe('q', function() {
describe("that is rejected", function() {
it("should reject with this new rejection reason",
function () {
- var returnedDef = defer()
+ var returnedDef = defer();
returnedDef.reject('bar');
promise['finally'](fin(1, returnedDef.promise))
- .then(success(2), error(1))
+ .then(success(2), error(1));
syncResolve(deferred, 'foo');
expect(logStr()).toBe('finally1()->{}; error1(bar)->reject(bar)');
});
@@ -847,7 +848,7 @@ describe('q', function() {
describe("when the callback throws an exception", function() {
it("should reject with this new exception", function() {
promise['finally'](fin(1, "exception", true))
- .then(success(1), error(2))
+ .then(success(1), error(2));
syncResolve(deferred, 'foo');
expect(logStr()).toBe('finally1()->throw(exception); error2(exception)->reject(exception)');
});
@@ -860,14 +861,14 @@ describe('q', function() {
it("should call the callback", function () {
promise['finally'](fin(1))
- .then(success(2), error(1))
+ .then(success(2), error(1));
syncReject(deferred, 'foo');
expect(logStr()).toBe('finally1(); error1(foo)->reject(foo)');
});
it('should reject with the original reason', function() {
promise['finally'](fin(1), "hello")
- .then(success(2), error(2))
+ .then(success(2), error(2));
syncReject(deferred, 'original');
expect(logStr()).toBe('finally1(); error2(original)->reject(original)');
});
@@ -877,10 +878,10 @@ describe('q', function() {
describe("that is fulfilled", function() {
it("should reject with the original reason after that promise resolves", function () {
- var returnedDef = defer()
+ var returnedDef = defer();
returnedDef.resolve('bar');
promise['finally'](fin(1, returnedDef.promise))
- .then(success(2), error(2))
+ .then(success(2), error(2));
syncReject(deferred, 'original');
expect(logStr()).toBe('finally1()->{}; error2(original)->reject(original)');
});
@@ -890,10 +891,10 @@ describe('q', function() {
describe("that is rejected", function () {
it("should reject with the new reason", function() {
- var returnedDef = defer()
+ var returnedDef = defer();
returnedDef.reject('bar');
promise['finally'](fin(1, returnedDef.promise))
- .then(success(2), error(1))
+ .then(success(2), error(1));
syncResolve(deferred, 'foo');
expect(logStr()).toBe('finally1()->{}; error1(bar)->reject(bar)');
});
@@ -906,7 +907,7 @@ describe('q', function() {
it("should reject with this new exception", function() {
promise['finally'](fin(1, "exception", true))
- .then(success(1), error(2))
+ .then(success(1), error(2));
syncResolve(deferred, 'foo');
expect(logStr()).toBe('finally1()->throw(exception); error2(exception)->reject(exception)');
});
@@ -918,7 +919,7 @@ describe('q', function() {
describe('catch', function() {
it('should be a shorthand for defining promise error handlers', function() {
- promise['catch'](error(1)).then(null, error(2))
+ promise['catch'](error(1)).then(null, error(2));
syncReject(deferred, 'foo');
expect(logStr()).toBe('error1(foo)->reject(foo); error2(foo)->reject(foo)');
});
@@ -937,7 +938,7 @@ describe('q', function() {
it('should package an exception into a rejected promise', function() {
- var rejectedPromise = q.reject(Error('not gonna happen'));
+ var rejectedPromise = q.reject(new Error('not gonna happen'));
promise.then(success(), error());
syncResolve(deferred, rejectedPromise);
expect(log).toEqual(['error(Error: not gonna happen)->reject(Error: not gonna happen)']);
@@ -955,7 +956,7 @@ describe('q', function() {
it('should catch exceptions thrown in errback and forward them to derived promises', function() {
var rejectedPromise = q.reject('rejected');
rejectedPromise.then(null, error('Broken', 'catch me!', true)).
- then(null, error('Affected'))
+ then(null, error('Affected'));
mockNextTick.flush();
expect(log).toEqual(['errorBroken(rejected)->throw(catch me!)', 'errorAffected(catch me!)->reject(catch me!)']);
});
@@ -1355,13 +1356,13 @@ describe('q', function() {
logger: function(e) {
mockExceptionLogger.log.push(e);
}
- }
+ };
beforeEach(function() {
q = qFactory(mockNextTick.nextTick, mockExceptionLogger.logger),
defer = q.defer;
- deferred = defer()
+ deferred = defer();
promise = deferred.promise;
log = [];
mockExceptionLogger.log = [];
@@ -1413,7 +1414,8 @@ describe('q', function() {
log = [];
syncResolve(deferred, 'ok');
expect(logStr()).toBe('success(ok)->ok');
- });
+ }
+ );
});
diff --git a/test/ng/rafSpec.js b/test/ng/rafSpec.js
index 7c67b8c9409f..46313b08c4c7 100644
--- a/test/ng/rafSpec.js
+++ b/test/ng/rafSpec.js
@@ -27,7 +27,7 @@ describe('$$rAF', function() {
try {
$$rAF.flush();
- } catch(e) {};
+ } catch(e) {}
expect(present).toBe(true);
}));
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js
index 13efd5d9110e..3613869c0741 100644
--- a/test/ng/rootScopeSpec.js
+++ b/test/ng/rootScopeSpec.js
@@ -13,6 +13,7 @@ describe('Scope', function() {
it('should expose the constructor', inject(function($rootScope) {
+ /* jshint -W103 */
if (msie) return;
expect($rootScope.__proto__).toBe($rootScope.constructor.prototype);
}));
@@ -251,7 +252,7 @@ describe('Scope', function() {
try {
$rootScope.$digest();
- throw Error('Should have thrown exception');
+ throw new Error('Should have thrown exception');
} catch(e) {
expect(e.message.match(/"fn: (watcherA|function)/g).length).toBe(10);
}
@@ -260,27 +261,27 @@ describe('Scope', function() {
it('should prevent infinite loop when creating and resolving a promise in a watched expression', function() {
module(function($rootScopeProvider) {
- $rootScopeProvider.digestTtl(10);
+ $rootScopeProvider.digestTtl(10);
});
inject(function($rootScope, $q) {
- var d = $q.defer();
+ var d = $q.defer();
- d.resolve('Hello, world.');
- $rootScope.$watch(function () {
- var $d2 = $q.defer();
- $d2.resolve('Goodbye.');
- $d2.promise.then(function () { });
- return d.promise;
- }, function () { return 0; });
+ d.resolve('Hello, world.');
+ $rootScope.$watch(function () {
+ var $d2 = $q.defer();
+ $d2.resolve('Goodbye.');
+ $d2.promise.then(function () { });
+ return d.promise;
+ }, function () { return 0; });
- expect(function() {
- $rootScope.$digest();
- }).toThrowMinErr('$rootScope', 'infdig', '10 $digest() iterations reached. Aborting!\n'+
- 'Watchers fired in the last 5 iterations: []');
+ expect(function() {
+ $rootScope.$digest();
+ }).toThrowMinErr('$rootScope', 'infdig', '10 $digest() iterations reached. Aborting!\n'+
+ 'Watchers fired in the last 5 iterations: []');
- expect($rootScope.$$phase).toBeNull();
- });
+ expect($rootScope.$$phase).toBeNull();
});
+ });
it('should not fire upon $watch registration on initial $digest', inject(function($rootScope) {
@@ -748,7 +749,7 @@ describe('Scope', function() {
$rootScope.$watch(log.fn('w4'), function() {
log('w4action');
$rootScope.$evalAsync(function() {
- log('evalAsync')
+ log('evalAsync');
});
});
$rootScope.$digest();
@@ -1136,7 +1137,8 @@ describe('Scope', function() {
expect($rootScope.$$asyncQueue).toEqual([
{scope: $rootScope, expression: 'rootExpression'},
{scope: childScope, expression: 'childExpression'},
- {scope: isolateScope, expression: 'isolateExpression'}]);
+ {scope: isolateScope, expression: 'isolateExpression'}
+ ]);
}));
@@ -1316,9 +1318,11 @@ describe('Scope', function() {
});
});
- expect(function() { childScope2.$apply(function() {
- childScope2.x = 'something';
- }); }).toThrowMinErr('$rootScope', 'inprog', '$digest already in progress');
+ expect(function() {
+ childScope2.$apply(function() {
+ childScope2.x = 'something';
+ });
+ }).toThrowMinErr('$rootScope', 'inprog', '$digest already in progress');
}));
});
});
@@ -1737,7 +1741,7 @@ describe('Scope', function() {
expect(scope.greeting).toEqual(undefined);
scope.$watch('name', function() {
- scope.greeting = scope.salutation + ' ' + scope.name + '!';
+ scope.greeting = scope.salutation + ' ' + scope.name + '!';
}); // initialize the watch
expect(scope.greeting).toEqual(undefined);
diff --git a/test/ng/sanitizeUriSpec.js b/test/ng/sanitizeUriSpec.js
index 7de3f065d23b..d1331b0944b2 100644
--- a/test/ng/sanitizeUriSpec.js
+++ b/test/ng/sanitizeUriSpec.js
@@ -1,3 +1,4 @@
+/* jshint scripturl: true */
'use strict';
describe('sanitizeUri', function() {
@@ -12,7 +13,7 @@ describe('sanitizeUri', function() {
};
sanitizeImg = function(uri) {
return $$sanitizeUri(uri, true);
- }
+ };
});
});
@@ -223,10 +224,10 @@ describe('sanitizeUri', function() {
expect(returnVal).toBe(sanitizeUriProvider);
testUrl = "javascript:doEvilStuff()";
- expect(sanitizeHref(testUrl)).toBe('javascript:doEvilStuff()');
+ expect(sanitizeHref(testUrl)).toBe('javascript:doEvilStuff()');
testUrl = "http://recon/figured";
- expect(sanitizeHref(testUrl)).toBe('unsafe:http://recon/figured');
+ expect(sanitizeHref(testUrl)).toBe('unsafe:http://recon/figured');
});
});
diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js
index 40e79c5737ff..dfb260f24742 100644
--- a/test/ng/sceSpecs.js
+++ b/test/ng/sceSpecs.js
@@ -38,6 +38,7 @@ describe('SCE', function() {
inject(function($window, $injector) {
function constructSce() {
+ /* global $SceProvider: false */
var sceProvider = new $SceProvider();
sceProvider.enabled(enabled);
return $injector.invoke(sceProvider.$get, sceProvider);
@@ -162,7 +163,7 @@ describe('SCE', function() {
};
}
var wrappedValue = new TrustedValueHolder("originalValue");
- expect(function() { return $sce.getTrusted($sce.HTML, wrappedValue) }).toThrowMinErr(
+ expect(function() { return $sce.getTrusted($sce.HTML, wrappedValue); }).toThrowMinErr(
'$sce', 'unsafe', 'Attempting to use an unsafe value in a safe context.');
}));
@@ -179,9 +180,9 @@ describe('SCE', function() {
it('should override the default $sce.trustAs/valueOf/etc.', function() {
module(function($provide) {
$provide.value('$sceDelegate', {
- trustAs: function(type, value) { return "wrapped:" + value; },
- getTrusted: function(type, value) { return "unwrapped:" + value; },
- valueOf: function(value) { return "valueOf:" + value; }
+ trustAs: function(type, value) { return "wrapped:" + value; },
+ getTrusted: function(type, value) { return "unwrapped:" + value; },
+ valueOf: function(value) { return "valueOf:" + value; }
});
});
@@ -196,7 +197,7 @@ describe('SCE', function() {
describe('$sce.parseAs', function($sce) {
- it('should parse constant literals as trusted', inject(function($sce) {
+ it('should parse constant literals as trusted', inject(function($sce) {
expect($sce.parseAsJs('1')()).toBe(1);
expect($sce.parseAsJs('1', $sce.ANY)()).toBe(1);
expect($sce.parseAsJs('1', $sce.HTML)()).toBe(1);
@@ -218,7 +219,7 @@ describe('SCE', function() {
it('should NOT return untrusted values from expression function', inject(function($sce) {
var exprFn = $sce.parseAs($sce.HTML, 'foo');
expect(function() {
- return exprFn({}, {'foo': true})
+ return exprFn({}, {'foo': true});
}).toThrowMinErr(
'$sce', 'unsafe', 'Attempting to use an unsafe value in a safe context.');
}));
@@ -226,7 +227,7 @@ describe('SCE', function() {
it('should NOT return trusted values of the wrong type from expression function', inject(function($sce) {
var exprFn = $sce.parseAs($sce.HTML, 'foo');
expect(function() {
- return exprFn({}, {'foo': $sce.trustAs($sce.JS, '123')})
+ return exprFn({}, {'foo': $sce.trustAs($sce.JS, '123')});
}).toThrowMinErr(
'$sce', 'unsafe', 'Attempting to use an unsafe value in a safe context.');
}));
@@ -262,11 +263,11 @@ describe('SCE', function() {
}
});
inject(testFn);
- }
+ };
}
it('should default to "self" which allows relative urls', runTest({}, function($sce, $document) {
- expect($sce.getTrustedResourceUrl('foo/bar')).toEqual('foo/bar');
+ expect($sce.getTrustedResourceUrl('foo/bar')).toEqual('foo/bar');
}));
it('should reject everything when whitelist is empty', runTest(
@@ -276,7 +277,8 @@ describe('SCE', function() {
}, function($sce) {
expect(function() { $sce.getTrustedResourceUrl('#'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: #');
- }));
+ }
+ ));
it('should match against normalized urls', runTest(
{
@@ -285,7 +287,8 @@ describe('SCE', function() {
}, function($sce) {
expect(function() { $sce.getTrustedResourceUrl('foo'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: foo');
- }));
+ }
+ ));
it('should not accept unknown matcher type', function() {
expect(function() {
@@ -296,6 +299,7 @@ describe('SCE', function() {
});
describe('adjustMatcher', function() {
+ /* global adjustMatcher: false */
it('should rewrite regex into regex and add ^ & $ on either end', function() {
expect(adjustMatcher(/a.*b/).exec('a.b')).not.toBeNull();
expect(adjustMatcher(/a.*b/).exec('-a.b-')).toBeNull();
@@ -318,7 +322,8 @@ describe('SCE', function() {
// https doesn't match (mismatched protocol.)
expect(function() { $sce.getTrustedResourceUrl('https://example.com/foo'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: https://example.com/foo');
- }));
+ }
+ ));
it('should match entire regex', runTest(
{
@@ -335,7 +340,8 @@ describe('SCE', function() {
// Prefix not allowed even though original regex does not contain a leading ^.
expect(function() { $sce.getTrustedResourceUrl('xhttp://example.com/foo'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: xhttp://example.com/foo');
- }));
+ }
+ ));
});
describe('string matchers', function() {
@@ -354,7 +360,8 @@ describe('SCE', function() {
// You can match a suffix.
expect(function() { $sce.getTrustedResourceUrl('xhttp://example.com/foo'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: xhttp://example.com/foo');
- }));
+ }
+ ));
it('should support the * wildcard', runTest(
{
@@ -382,7 +389,8 @@ describe('SCE', function() {
// The * wildcard does not match ';'
expect(function() { $sce.getTrustedResourceUrl('http://example-com/foo;bar'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: http://example-com/foo;bar');
- }));
+ }
+ ));
it('should support the ** wildcard', runTest(
{
@@ -394,7 +402,8 @@ describe('SCE', function() {
expect($sce.getTrustedResourceUrl('http://example.com/foo-bar')).toEqual('http://example.com/foo-bar');
// The ** wildcard accepts the ':/.?&' characters.
expect($sce.getTrustedResourceUrl('http://example.com/foo:1/2.3?4&5-6')).toEqual('http://example.com/foo:1/2.3?4&5-6');
- }));
+ }
+ ));
it('should not accept *** in the string', function() {
expect(function() {
@@ -412,7 +421,8 @@ describe('SCE', function() {
blackList: []
}, function($sce) {
expect($sce.getTrustedResourceUrl('foo')).toEqual('foo');
- }));
+ }
+ ));
it('should support the special string "self" in blacklist', runTest(
{
@@ -421,7 +431,8 @@ describe('SCE', function() {
}, function($sce) {
expect(function() { $sce.getTrustedResourceUrl('foo'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: foo');
- }));
+ }
+ ));
});
it('should have blacklist override the whitelist', runTest(
@@ -431,7 +442,8 @@ describe('SCE', function() {
}, function($sce) {
expect(function() { $sce.getTrustedResourceUrl('foo'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: foo');
- }));
+ }
+ ));
it('should support multiple items in both lists', runTest(
{
@@ -445,7 +457,8 @@ describe('SCE', function() {
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: http://example.com/3');
expect(function() { $sce.getTrustedResourceUrl('open_redirect'); }).toThrowMinErr(
'$sce', 'insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: open_redirect');
- }));
+ }
+ ));
});
describe('sanitizing html', function() {
diff --git a/test/ng/snifferSpec.js b/test/ng/snifferSpec.js
index 3f8d33510273..b50423f0c9b3 100644
--- a/test/ng/snifferSpec.js
+++ b/test/ng/snifferSpec.js
@@ -3,6 +3,7 @@
describe('$sniffer', function() {
function sniffer($window, $document) {
+ /* global $SnifferProvider: false */
$window.navigator = {};
$document = jqLite($document || {});
if (!$document[0].body) {
diff --git a/test/ng/urlUtilsSpec.js b/test/ng/urlUtilsSpec.js
index 543ff3fb6b41..e5e7306fd1d7 100644
--- a/test/ng/urlUtilsSpec.js
+++ b/test/ng/urlUtilsSpec.js
@@ -20,7 +20,7 @@ describe('urlUtils', function() {
//IE counts / as empty, necessary to use / so that pathname is not context.html
var parsed = urlResolve('/');
expect(parsed.pathname).toBe('/');
- })
+ });
});
describe('isSameOrigin', function() {
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index 16307de59d31..2034744fe03c 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -19,7 +19,7 @@ describe("ngAnimate", function() {
hasBeenAnimated = true;
done();
}
- }
+ };
});
});
inject(function($rootScope, $compile, $animate, $rootElement, $document) {
@@ -70,9 +70,9 @@ describe("ngAnimate", function() {
var element, $rootElement;
- function html(html) {
+ function html(content) {
body.append($rootElement);
- $rootElement.html(html);
+ $rootElement.html(content);
element = $rootElement.children().eq(0);
return element;
}
@@ -100,7 +100,7 @@ describe("ngAnimate", function() {
count++;
done();
}
- }
+ };
});
});
inject(function($compile, $rootScope, $animate, $sniffer, $rootElement, $timeout) {
@@ -153,7 +153,7 @@ describe("ngAnimate", function() {
count++;
done();
}
- }
+ };
});
});
inject(function($compile, $rootScope, $animate, $sniffer, $rootElement, $timeout) {
@@ -179,7 +179,7 @@ describe("ngAnimate", function() {
captured = true;
done();
}
- }
+ };
});
});
inject(function($animate, $rootElement, $rootScope, $compile, $timeout) {
@@ -222,43 +222,43 @@ describe("ngAnimate", function() {
start: function(element, done) {
done();
}
- }
+ };
});
- $animateProvider.register('.custom-delay', function($timeout) {
+ $animateProvider.register('.custom-delay', function($timeout) {
function animate(element, done) {
done = arguments.length == 3 ? arguments[2] : done;
$timeout(done, 2000, false);
return function() {
element.addClass('animation-cancelled');
- }
+ };
}
return {
leave : animate,
addClass : animate,
removeClass : animate
- }
+ };
});
- $animateProvider.register('.custom-long-delay', function($timeout) {
+ $animateProvider.register('.custom-long-delay', function($timeout) {
function animate(element, done) {
done = arguments.length == 3 ? arguments[2] : done;
$timeout(done, 20000, false);
return function(cancelled) {
element.addClass(cancelled ? 'animation-cancelled' : 'animation-ended');
- }
+ };
}
return {
leave : animate,
addClass : animate,
removeClass : animate
- }
+ };
});
- $animateProvider.register('.setup-memo', function() {
+ $animateProvider.register('.setup-memo', function() {
return {
removeClass: function(element, className, done) {
element.text('memento');
done();
}
- }
+ };
});
return function($animate, $compile, $rootScope, $rootElement) {
element = $compile('
')($rootScope);
@@ -276,7 +276,7 @@ describe("ngAnimate", function() {
$rootElement.append(element);
};
});
- })
+ });
it("should animate the enter animation event",
@@ -395,7 +395,7 @@ describe("ngAnimate", function() {
}
};
});
- })
+ });
inject(function($animate, $rootScope, $sniffer, $timeout) {
child.attr('class','classify no');
$animate.setClass(child, 'yes', 'no');
@@ -437,7 +437,7 @@ describe("ngAnimate", function() {
}
};
});
- })
+ });
inject(function($animate, $rootScope, $sniffer, $timeout) {
child.attr('class','classify no');
$animate.setClass(child, 'yes', 'no');
@@ -687,7 +687,8 @@ describe("ngAnimate", function() {
$timeout.flush(20000);
expect(element.hasClass('custom-delay')).toBe(true);
expect(element.hasClass('custom-long-delay')).toBe(true);
- }));
+ })
+ );
it("should allow both multiple JS and CSS animations which run in parallel",
@@ -729,7 +730,7 @@ describe("ngAnimate", function() {
return function(_$rootElement_) {
$rootElement = _$rootElement_;
};
- })
+ });
});
/* The CSS animation handler must always be rendered before the other JS animation
@@ -744,13 +745,13 @@ describe("ngAnimate", function() {
$animateProvider.register('', function() {
return {
leave : function() { log.push('css'); }
- }
+ };
});
//custom JS animation handler
$animateProvider.register('.js-animation', function() {
return {
leave : function() { log.push('js'); }
- }
+ };
});
});
inject(function($animate, $rootScope, $compile, $sniffer) {
@@ -890,7 +891,8 @@ describe("ngAnimate", function() {
}
expect(element.hasClass('ng-hide-remove-active')).toBe(false);
- }));
+ })
+ );
it("should stagger the items when the correct CSS class is provided",
@@ -918,13 +920,13 @@ describe("ngAnimate", function() {
var container = $compile(html('
'))($rootScope);
- var elements = [];
+ var newScope, element, elements = [];
for(var i = 0; i < 5; i++) {
- var newScope = $rootScope.$new();
- var element = $compile('
')(newScope);
+ newScope = $rootScope.$new();
+ element = $compile('
')(newScope);
$animate.enter(element, container);
elements.push(element);
- };
+ }
$rootScope.$digest();
$animate.triggerReflow();
@@ -938,13 +940,13 @@ describe("ngAnimate", function() {
//final closing timeout
$timeout.flush();
- for(var i = 0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
dealoc(elements[i]);
- var newScope = $rootScope.$new();
- var element = $compile('
')(newScope);
+ newScope = $rootScope.$new();
+ element = $compile('
')(newScope);
$animate.enter(element, container);
elements[i] = element;
- };
+ }
$rootScope.$digest();
@@ -982,7 +984,7 @@ describe("ngAnimate", function() {
var element = $compile('
')(newScope);
$animate.enter(element, container);
elements.push(element);
- };
+ }
$rootScope.$digest();
@@ -1025,7 +1027,7 @@ describe("ngAnimate", function() {
var element = $compile('
')(newScope);
$animate.enter(element, container);
elements.push(element);
- };
+ }
$rootScope.$digest();
$animate.triggerReflow();
@@ -1132,7 +1134,8 @@ describe("ngAnimate", function() {
browserTrigger(element,'transitionend', { timeStamp: now + 3000, elapsedTime: 3 });
}
expect(element).toBeShown();
- }));
+ })
+ );
it("should NOT overwrite styles with outdated values when animation completes",
@@ -1190,7 +1193,8 @@ describe("ngAnimate", function() {
browserTrigger(element,'animationend', { timeStamp: Date.now() + 11000, elapsedTime: 11 });
expect(element.hasClass('ng-hide-remove-active')).toBe(false);
}
- }));
+ })
+ );
it("should finish the previous transition when a new animation is started",
@@ -1223,7 +1227,8 @@ describe("ngAnimate", function() {
expect(element.hasClass('ng-hide-add')).toBe(true);
expect(element.hasClass('ng-hide-add-active')).toBe(true);
}
- }));
+ })
+ );
it("should place a hard block when a structural CSS transition is run",
inject(function($animate, $rootScope, $compile, $sniffer, $timeout, $document, $rootElement) {
@@ -1298,13 +1303,13 @@ describe("ngAnimate", function() {
var container = $compile(html('
'))($rootScope);
- var elements = [];
+ var newScope, element, elements = [];
for(var i = 0; i < 5; i++) {
- var newScope = $rootScope.$new();
- var element = $compile('
')(newScope);
+ newScope = $rootScope.$new();
+ element = $compile('
')(newScope);
$animate.enter(element, container);
elements.push(element);
- };
+ }
$rootScope.$digest();
$animate.triggerReflow();
@@ -1315,13 +1320,13 @@ describe("ngAnimate", function() {
expect(elements[3].attr('style')).toMatch(/transition-delay: 0\.3\d*s/);
expect(elements[4].attr('style')).toMatch(/transition-delay: 0\.4\d*s/);
- for(var i = 0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
dealoc(elements[i]);
- var newScope = $rootScope.$new();
- var element = $compile('
')(newScope);
+ newScope = $rootScope.$new();
+ element = $compile('
')(newScope);
$animate.enter(element, container);
elements[i] = element;
- };
+ }
$rootScope.$digest();
$animate.triggerReflow();
@@ -1357,7 +1362,7 @@ describe("ngAnimate", function() {
var element = $compile('
')(newScope);
$animate.enter(element, container);
elements.push(element);
- };
+ }
$rootScope.$digest();
$animate.triggerReflow();
@@ -1410,8 +1415,8 @@ describe("ngAnimate", function() {
return currentTimestamp;
});
}
- }
- })
+ };
+ });
inject(function($animate, $rootScope, $compile, $sniffer, $timeout) {
if (!$sniffer.transitions) return;
@@ -1481,13 +1486,13 @@ describe("ngAnimate", function() {
$animate.triggerReflow(); //reflow
expect(element.children().length).toBe(5);
- for(var i = 0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
expect(kids[i].hasClass('ng-enter-active')).toBe(true);
}
$timeout.flush(7500);
- for(var i = 0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
expect(kids[i].hasClass('ng-enter-active')).toBe(true);
}
@@ -1496,13 +1501,13 @@ describe("ngAnimate", function() {
//9500 - 7500 = 2000
$timeout.flush(1999); //remove 1999 more
- for(var i = 0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
expect(kids[i].hasClass('ng-enter-active')).toBe(true);
}
$timeout.flush(1); //up to 2000ms
- for(var i = 0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
expect(kids[i].hasClass('ng-enter-active')).toBe(false);
}
}));
@@ -1567,7 +1572,7 @@ describe("ngAnimate", function() {
var element = $compile('
')(newScope);
$animate.enter(element, container);
elements.push(element);
- };
+ }
$rootScope.$digest();
$animate.triggerReflow();
@@ -1580,7 +1585,7 @@ describe("ngAnimate", function() {
expect(elements[2].attr('style')).toMatch(/transition-delay:\s+1.2\d*/);
expect(elements[2].attr('style')).toMatch(/animation-delay: 1\.4\d*s,\s*2\.4\d*s/);
- for(var i = 0; i < 3; i++) {
+ for(i = 0; i < 3; i++) {
browserTrigger(elements[i],'transitionend', { timeStamp: Date.now() + 22000, elapsedTime: 22000 });
expect(elements[i].attr('style')).toBeFalsy();
}
@@ -1675,16 +1680,16 @@ describe("ngAnimate", function() {
removeClass : function(element, className, done) {
$timeout(done, 2000);
}
- }
+ };
});
- $animateProvider.register('.other', function() {
+ $animateProvider.register('.other', function($timeout) {
return {
enter : function(element, done) {
$timeout(done, 10000);
}
- }
+ };
});
- })
+ });
});
@@ -2004,7 +2009,7 @@ describe("ngAnimate", function() {
captured = 'removeClass-' + className;
$timeout(done, 3000, false);
}
- }
+ };
});
});
});
@@ -2327,7 +2332,7 @@ describe("ngAnimate", function() {
$rootElement = _$rootElement_;
$document = _$document_;
$animate.enabled(true);
- }
+ };
}));
function html(element) {
@@ -2412,9 +2417,9 @@ describe("ngAnimate", function() {
element.addClass('i-was-animated');
$timeout(done, 10, false);
}
- }
+ };
});
- })
+ });
inject(function($compile, $rootScope, $animate, $sniffer, $timeout) {
ss.addRule('.ng-enter', '-webkit-transition: 1s linear all;' +
@@ -2447,7 +2452,7 @@ describe("ngAnimate", function() {
element.addClass('this-is-mine-now');
$timeout(done, 55, false);
}
- }
+ };
});
});
inject(function($compile, $rootScope, $animate, $sniffer, $timeout) {
@@ -2620,12 +2625,12 @@ describe("ngAnimate", function() {
move : function(element, done) {
fn = function() {
done();
- }
+ };
return function() {
interceptedClass = element.attr('class');
- }
+ };
}
- }
+ };
});
});
inject(function($compile, $rootScope, $animate, $timeout) {
@@ -2662,9 +2667,9 @@ describe("ngAnimate", function() {
element.data('classify','add-' + className);
done();
}
- }
+ };
});
- })
+ });
inject(function($compile, $rootScope, $animate) {
var element = html($compile('
')($rootScope));
@@ -2758,14 +2763,14 @@ describe("ngAnimate", function() {
step = done;
return function(cancelled) {
animationState = cancelled ? 'enter-cancel' : animationState;
- }
+ };
},
addClass : function(element, className, done) {
animationState = 'addClass';
step = done;
return function(cancelled) {
animationState = cancelled ? 'addClass-cancel' : animationState;
- }
+ };
}
};
});
@@ -2857,7 +2862,7 @@ describe("ngAnimate", function() {
childAnimated = true;
done();
}
- }
+ };
});
$animateProvider.register('.container', function() {
return {
@@ -2865,7 +2870,7 @@ describe("ngAnimate", function() {
containerAnimated = true;
done();
}
- }
+ };
});
});
@@ -2918,8 +2923,8 @@ describe("ngAnimate", function() {
continueAnimation = function() {
continueAnimation = angular.noop;
(done || className)();
- }
- }
+ };
+ };
}
});
});
@@ -2993,7 +2998,7 @@ describe("ngAnimate", function() {
intercepted = true;
done();
}
- }
+ };
});
});
@@ -3025,16 +3030,16 @@ describe("ngAnimate", function() {
});
inject(function($animate, $rootScope, $compile, $rootElement, $timeout, $document, $sniffer) {
- if(!$sniffer.transitions) return;
+ if(!$sniffer.transitions) return;
$animate.enabled(true);
- var element = $compile('
')($rootScope);
+ var kid, element = $compile('
')($rootScope);
$rootElement.append(element);
jqLite($document[0].body).append($rootElement);
for(var i=0;i<20;i++) {
- var kid = $compile('
')($rootScope);
+ kid = $compile('
')($rootScope);
$animate.enter(kid, element);
}
$rootScope.$digest();
@@ -3045,8 +3050,8 @@ describe("ngAnimate", function() {
dealoc(element);
count = 0;
- for(var i=0;i<20;i++) {
- var kid = $compile('
')($rootScope);
+ for(i=0;i<20;i++) {
+ kid = $compile('
')($rootScope);
$animate.enter(kid, element);
}
@@ -3100,8 +3105,8 @@ describe("ngAnimate", function() {
function assertClasses(str) {
var className = element.attr('class');
- str.length == 0
- ? className.length == 0
+ str.length === 0
+ ? className.length === 0
: expect(className.split(/\s+/)).toEqual(str.split(' '));
}
@@ -3140,14 +3145,14 @@ describe("ngAnimate", function() {
currentFn = done;
return function(cancelled) {
currentAnimation = cancelled ? null : currentAnimation;
- }
+ };
},
beforeRemoveClass : function(element, className, done) {
currentAnimation = 'removeClass';
currentFn = done;
return function(cancelled) {
currentAnimation = cancelled ? null : currentAnimation;
- }
+ };
}
};
});
@@ -3179,7 +3184,7 @@ describe("ngAnimate", function() {
count++;
done();
}
- }
+ };
});
});
inject(function($compile, $rootScope, $animate, $sniffer, $rootElement, $timeout) {
@@ -3376,7 +3381,7 @@ describe("ngAnimate", function() {
expect($window.getComputedStyle(element[0])[prop + 'Duration']).toBe('1s');
done();
}
- }
+ };
});
});
inject(function($rootScope, $compile, $rootElement, $document, $animate, $sniffer, $timeout, $window) {
@@ -3424,7 +3429,8 @@ describe("ngAnimate", function() {
browserTrigger(element, 'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 0.50999999991 });
expect($rootElement.children().length).toBe(0);
- }));
+ })
+ );
it('should properly animate elements with compound directives', function() {
@@ -3440,7 +3446,7 @@ describe("ngAnimate", function() {
capturedAnimation = 'leave';
done();
}
- }
+ };
});
});
inject(function($rootScope, $compile, $rootElement, $document, $timeout, $templateCache, $sniffer, $animate) {
@@ -3494,7 +3500,7 @@ describe("ngAnimate", function() {
return function(element, className, done) {
captures[key] = true;
(done || className)();
- }
+ };
}
});
});
@@ -3545,7 +3551,7 @@ describe("ngAnimate", function() {
return function(element, className, done) {
captures[key] = true;
(done || className)();
- }
+ };
}
});
});
diff --git a/test/ngCookies/cookiesSpec.js b/test/ngCookies/cookiesSpec.js
index 1d669c1c6b8a..08b37950d0e6 100644
--- a/test/ngCookies/cookiesSpec.js
+++ b/test/ngCookies/cookiesSpec.js
@@ -145,5 +145,5 @@ describe('$cookieStore', function() {
$browser.cookieHash['blankCookie'] = '';
$browser.poll();
expect($cookieStore.get("blankCookie")).toEqual('');
- }))
+ }));
});
diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js
index 4c9a4f49d207..cac9d9bd83b1 100644
--- a/test/ngMock/angular-mocksSpec.js
+++ b/test/ngMock/angular-mocksSpec.js
@@ -246,29 +246,29 @@ describe('ngMock', function() {
it('should assertEmpty', function(){
try {
- $log.error(Error('MyError'));
- $log.warn(Error('MyWarn'));
- $log.info(Error('MyInfo'));
- $log.log(Error('MyLog'));
- $log.debug(Error('MyDebug'));
+ $log.error(new Error('MyError'));
+ $log.warn(new Error('MyWarn'));
+ $log.info(new Error('MyInfo'));
+ $log.log(new Error('MyLog'));
+ $log.debug(new Error('MyDebug'));
$log.assertEmpty();
} catch (error) {
- error = error.message || error;
- expect(error).toMatch(/Error: MyError/m);
- expect(error).toMatch(/Error: MyWarn/m);
- expect(error).toMatch(/Error: MyInfo/m);
- expect(error).toMatch(/Error: MyLog/m);
- expect(error).toMatch(/Error: MyDebug/m);
+ var err = error.message || error;
+ expect(err).toMatch(/Error: MyError/m);
+ expect(err).toMatch(/Error: MyWarn/m);
+ expect(err).toMatch(/Error: MyInfo/m);
+ expect(err).toMatch(/Error: MyLog/m);
+ expect(err).toMatch(/Error: MyDebug/m);
} finally {
$log.reset();
}
});
it('should reset state', function(){
- $log.error(Error('MyError'));
- $log.warn(Error('MyWarn'));
- $log.info(Error('MyInfo'));
- $log.log(Error('MyLog'));
+ $log.error(new Error('MyError'));
+ $log.warn(new Error('MyWarn'));
+ $log.info(new Error('MyInfo'));
+ $log.log(new Error('MyLog'));
$log.reset();
var passed = false;
try {
@@ -345,7 +345,7 @@ describe('ngMock', function() {
it('should allow you to specify a number of iterations', inject(function($interval) {
var counter = 0;
- $interval(function() {counter++}, 1000, 2);
+ $interval(function() {counter++;}, 1000, 2);
$interval.flush(1000);
expect(counter).toBe(1);
@@ -406,7 +406,8 @@ describe('ngMock', function() {
$interval.flush(1000);
expect(log).toEqual([
- 'tick', 'promise update: 0', 'tick', 'promise update: 1', 'promise success: 2']);
+ 'tick', 'promise update: 0', 'tick', 'promise update: 1', 'promise success: 2'
+ ]);
}));
@@ -530,7 +531,8 @@ describe('ngMock', function() {
log = '';
}));
- function logFn(text){ return function() {
+ function logFn(text){
+ return function() {
log += text +';';
};
}
@@ -609,7 +611,7 @@ describe('ngMock', function() {
it('should expose flush method that will flush the pending queue of tasks', inject(
function($timeout) {
var logger = [],
- logFn = function(msg) { return function() { logger.push(msg) }};
+ logFn = function(msg) { return function() { logger.push(msg); }; };
$timeout(logFn('t1'));
$timeout(logFn('t2'), 200);
@@ -692,6 +694,7 @@ describe('ngMock', function() {
}));
it('should serialize scope that has overridden "hasOwnProperty"', inject(function($rootScope, $sniffer){
+ /* jshint -W001 */
// MS IE8 just doesn't work for this kind of thing, since "for ... in" doesn't return
// things like hasOwnProperty even if it is explicitly defined on the actual object!
if ($sniffer.msie<=8) return;
@@ -704,11 +707,11 @@ describe('ngMock', function() {
describe('angular.mock.clearDataCache', function() {
function keys(obj) {
- var keys = [];
+ var keysArr = [];
for(var key in obj) {
- if (obj.hasOwnProperty(key)) keys.push(key);
+ if (obj.hasOwnProperty(key)) keysArr.push(key);
}
- return keys.sort();
+ return keysArr.sort();
}
function browserTrigger(element, eventType) {
@@ -740,11 +743,11 @@ describe('ngMock', function() {
// crazy IE9 requires div to be connected to render DOM for click event to work
// mousemove works even when not connected. This is a heisen-bug since stepping
// through the code makes the test pass. Viva IE!!!
- angular.element(document.body).append(div)
+ angular.element(document.body).append(div);
- div.on('click', function() { log += 'click1;'});
- div.on('click', function() { log += 'click2;'});
- div.on('mousemove', function() { log += 'mousemove;'});
+ div.on('click', function() { log += 'click1;'; });
+ div.on('click', function() { log += 'click2;'; });
+ div.on('mousemove', function() { log += 'mousemove;'; });
browserTrigger(div, 'click');
browserTrigger(div, 'mousemove');
@@ -867,7 +870,7 @@ describe('ngMock', function() {
}));
afterEach(function() {
- expect(log).toEqual('module;inject;')
+ expect(log).toEqual('module;inject;');
});
});
@@ -1423,6 +1426,7 @@ describe('ngMock', function() {
describe('MockHttpExpectation', function() {
+ /* global MockHttpExpectation */
it('should accept url as regexp', function() {
var exp = new MockHttpExpectation('GET', /^\/x/);
diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js
index ac011216bd7e..28d23ba33777 100644
--- a/test/ngResource/resourceSpec.js
+++ b/test/ngResource/resourceSpec.js
@@ -37,6 +37,7 @@ describe("resource", function() {
});
describe('isValidDottedPath', function() {
+ /* global isValidDottedPath: false */
it('should support arbitrary dotted names', function() {
expect(isValidDottedPath('')).toBe(false);
expect(isValidDottedPath('1')).toBe(false);
@@ -56,11 +57,12 @@ describe("resource", function() {
});
describe('lookupDottedPath', function() {
+ /* global lookupDottedPath: false */
var data = {a: {b: 'foo', c: null}};
it('should throw for invalid path', function() {
expect(function() {
- lookupDottedPath(data, '.ckck')
+ lookupDottedPath(data, '.ckck');
}).toThrowMinErr('$resource', 'badmember',
'Dotted member path "@.ckck" is invalid.');
});
@@ -100,6 +102,7 @@ describe("resource", function() {
describe('shallow copy', function() {
+ /* global shallowClearAndCopy */
it('should make a copy', function() {
var original = {key:{}};
var copy = shallowClearAndCopy(original);
@@ -129,7 +132,7 @@ describe("resource", function() {
it('should omit properties from prototype chain', function() {
var original, clone = {};
- function Func() {};
+ function Func() {}
Func.prototype.hello = "world";
original = new Func();
@@ -234,14 +237,14 @@ describe("resource", function() {
});
it('should not encode @ in url params', function() {
- //encodeURIComponent is too agressive and doesn't follow http://www.ietf.org/rfc/rfc3986.txt
- //with regards to the character set (pchar) allowed in path segments
- //so we need this test to make sure that we don't over-encode the params and break stuff like
- //buzz api which uses @self
-
- var R = $resource('/Path/:a');
- $httpBackend.expect('GET', '/Path/doh@fo%20o?!do%26h=g%3Da+h&:bar=$baz@1').respond('{}');
- R.get({a: 'doh@fo o', ':bar': '$baz@1', '!do&h': 'g=a h'});
+ //encodeURIComponent is too agressive and doesn't follow http://www.ietf.org/rfc/rfc3986.txt
+ //with regards to the character set (pchar) allowed in path segments
+ //so we need this test to make sure that we don't over-encode the params and break stuff like
+ //buzz api which uses @self
+
+ var R = $resource('/Path/:a');
+ $httpBackend.expect('GET', '/Path/doh@fo%20o?!do%26h=g%3Da+h&:bar=$baz@1').respond('{}');
+ R.get({a: 'doh@fo o', ':bar': '$baz@1', '!do&h': 'g=a h'});
});
it('should encode array params', function() {
@@ -251,9 +254,9 @@ describe("resource", function() {
});
it('should not encode string "null" to "+" in url params', function() {
- var R = $resource('/Path/:a');
- $httpBackend.expect('GET', '/Path/null').respond('{}');
- R.get({a: 'null'});
+ var R = $resource('/Path/:a');
+ $httpBackend.expect('GET', '/Path/null').respond('{}');
+ R.get({a: 'null'});
});
@@ -399,9 +402,9 @@ describe("resource", function() {
it('should throw an exception if a param is called "hasOwnProperty"', function() {
- expect(function() {
+ expect(function() {
$resource('/:hasOwnProperty').get();
- }).toThrowMinErr('$resource','badname', "hasOwnProperty is not a valid parameter name");
+ }).toThrowMinErr('$resource','badname', "hasOwnProperty is not a valid parameter name");
});
@@ -437,7 +440,7 @@ describe("resource", function() {
it('should send correct headers', function() {
$httpBackend.expectPUT('/CreditCard/123', undefined, function(headers) {
- return headers['If-None-Match'] == "*";
+ return headers['If-None-Match'] == "*";
}).respond({id:123});
CreditCard.conditionalPut({id: {key:123}});
@@ -612,9 +615,12 @@ describe("resource", function() {
it('should support dynamic default parameters (action specific)', function() {
var currentGroup = 'students',
- Person = $resource('/Person/:group/:id', {}, {
- fetch: {method: 'GET', params: {group: function() { return currentGroup; }}}
- });
+ Person = $resource('/Person/:group/:id', {}, {
+ fetch: {
+ method: 'GET',
+ params: {group: function() { return currentGroup; }}
+ }
+ });
$httpBackend.expect('GET', '/Person/students/fedor').respond({id: 'fedor', email: 'f@f.com'});
@@ -1027,14 +1033,14 @@ describe("resource", function() {
it('should transform request/response', function() {
var Person = $resource('/Person/:id', {}, {
save: {
- method: 'POST',
- params: {id: '@id'},
- transformRequest: function(data) {
- return angular.toJson({ __id: data.id });
- },
- transformResponse: function(data) {
- return { id: data.__id };
- }
+ method: 'POST',
+ params: {id: '@id'},
+ transformRequest: function(data) {
+ return angular.toJson({ __id: data.id });
+ },
+ transformResponse: function(data) {
+ return { id: data.__id };
+ }
}
});
@@ -1222,14 +1228,14 @@ describe("resource", function() {
// url parameter in action, parameter not ending the string
$httpBackend.expect('GET', '/Customer/123/pay').respond({id: 'abc'});
- var TypeItem = $resource('/foo/:type', {type: 'Order'}, {
+ TypeItem = $resource('/foo/:type', {type: 'Order'}, {
get: {
method: 'GET',
params: {type: 'Customer'},
url: '/:type/:typeId/pay'
}
});
- var item = TypeItem.get({typeId: 123});
+ item = TypeItem.get({typeId: 123});
$httpBackend.flush();
expect(item).toEqualData({id: 'abc'});
});
@@ -1297,7 +1303,7 @@ describe('resource', function() {
expect(failureSpy).toHaveBeenCalled();
expect(failureSpy.mostRecentCall.args[0]).toMatch(
/^\[\$resource:badcfg\] Error in resource configuration. Expected response to contain an object but got an array/
- )
+ );
});
diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js
index 11a13e408cd4..eb99ba28674e 100644
--- a/test/ngRoute/directive/ngViewSpec.js
+++ b/test/ngRoute/directive/ngViewSpec.js
@@ -228,7 +228,7 @@ describe('ngView', function() {
expect(elm.text()).toEqual('include: view: content');
expect($route.current.templateUrl).toEqual('viewPartial.html');
- dealoc(elm)
+ dealoc(elm);
});
});
@@ -237,7 +237,7 @@ describe('ngView', function() {
'templates were cached', function() {
//this is a test for a regression that was introduced by making the ng-view cache sync
function ParentCtrl($scope) {
- $scope.log.push('parent');
+ $scope.log.push('parent');
}
module(function($routeProvider) {
@@ -312,7 +312,8 @@ describe('ngView', function() {
var called = 0;
// we want to assert only during first watch
$rootScope.$watch(function() {
- if (!called++) expect(element.text()).toBe('');
+ if (!called) expect(element.text()).toBe('');
+ called++;
});
$rootScope.$digest();
@@ -347,7 +348,8 @@ describe('ngView', function() {
expect(element.text()).toBe('bound-value');
expect(log).toEqual([
- '$routeChangeStart', 'init-ctrl', '$viewContentLoaded', '$routeChangeSuccess' ]);
+ '$routeChangeStart', 'init-ctrl', '$viewContentLoaded', '$routeChangeSuccess'
+ ]);
});
});
@@ -441,7 +443,10 @@ describe('ngView', function() {
module(function($routeProvider) {
$routeProvider.when('/bar', {templateUrl: 'tpl.html', controller: createController('bar')});
$routeProvider.when('/foo', {
- templateUrl: 'tpl.html', controller: createController('foo'), reloadOnSearch: false});
+ templateUrl: 'tpl.html',
+ controller: createController('foo'),
+ reloadOnSearch: false
+ });
});
inject(function($templateCache, $location, $rootScope) {
@@ -652,8 +657,8 @@ describe('ngView animations', function() {
beforeEach(module('ngRoute'));
- function html(html) {
- $rootElement.html(html);
+ function html(content) {
+ $rootElement.html(content);
body.append($rootElement);
element = $rootElement.children().eq(0);
return element;
@@ -679,7 +684,7 @@ describe('ngView animations', function() {
return function($templateCache) {
$templateCache.put('/foo.html', [200, 'data
', {}]);
$templateCache.put('/bar.html', [200, 'data2
', {}]);
- }
+ };
}));
describe('hooks', function() {
@@ -741,7 +746,8 @@ describe('ngView animations', function() {
var itemA = animationA.args[0];
expect(itemA).not.toEqual(itemB);
- }));
+ })
+ );
it('should render ngClass on ngView',
inject(function($compile, $rootScope, $templateCache, $animate, $location, $timeout) {
@@ -761,7 +767,7 @@ describe('ngView animations', function() {
var animation = $animate.queue.shift();
expect(animation.event).toBe('addClass');
- var item = animation.element;
+ item = animation.element;
expect(item.hasClass('classy')).toBe(true);
$rootScope.klass = 'boring';
@@ -785,99 +791,100 @@ describe('ngView animations', function() {
expect($animate.queue.shift().event).toBe('addClass');
expect(item.hasClass('boring')).toBe(true);
- }));
-
- it('should not double compile when the route changes', function() {
-
- var window;
- module(function($routeProvider, $animateProvider, $provide) {
- $routeProvider.when('/foo', {template: '{{i}}
'});
- $routeProvider.when('/bar', {template: '{{i}}
'});
- $animateProvider.register('.my-animation', function() {
- return {
- leave: function(element, done) {
- done();
- }
- };
- });
+ })
+ );
+
+ it('should not double compile when the route changes', function() {
+
+ var window;
+ module(function($routeProvider, $animateProvider, $provide) {
+ $routeProvider.when('/foo', {template: '{{i}}
'});
+ $routeProvider.when('/bar', {template: '{{i}}
'});
+ $animateProvider.register('.my-animation', function() {
+ return {
+ leave: function(element, done) {
+ done();
+ }
+ };
});
+ });
- inject(function($rootScope, $compile, $location, $route, $timeout, $rootElement, $sniffer, $animate) {
- element = $compile(html('
'))($rootScope);
- $animate.enabled(true);
+ inject(function($rootScope, $compile, $location, $route, $timeout, $rootElement, $sniffer, $animate) {
+ element = $compile(html('
'))($rootScope);
+ $animate.enabled(true);
- $location.path('/foo');
- $rootScope.$digest();
+ $location.path('/foo');
+ $rootScope.$digest();
- expect($animate.queue.shift().event).toBe('enter'); //ngView
- expect($animate.queue.shift().event).toBe('enter'); //repeat 1
- expect($animate.queue.shift().event).toBe('enter'); //repeat 2
+ expect($animate.queue.shift().event).toBe('enter'); //ngView
+ expect($animate.queue.shift().event).toBe('enter'); //repeat 1
+ expect($animate.queue.shift().event).toBe('enter'); //repeat 2
- expect(element.text()).toEqual('12');
+ expect(element.text()).toEqual('12');
- $location.path('/bar');
- $rootScope.$digest();
+ $location.path('/bar');
+ $rootScope.$digest();
- expect($animate.queue.shift().event).toBe('enter'); //ngView new
- expect($animate.queue.shift().event).toBe('leave'); //ngView old
+ expect($animate.queue.shift().event).toBe('enter'); //ngView new
+ expect($animate.queue.shift().event).toBe('leave'); //ngView old
- $rootScope.$digest();
+ $rootScope.$digest();
+
+ expect($animate.queue.shift().event).toBe('enter'); //ngRepeat 3
+ expect($animate.queue.shift().event).toBe('enter'); //ngRepeat 4
- expect($animate.queue.shift().event).toBe('enter'); //ngRepeat 3
- expect($animate.queue.shift().event).toBe('enter'); //ngRepeat 4
+ expect(element.text()).toEqual('34');
- expect(element.text()).toEqual('34');
+ function n(text) {
+ return text.replace(/\r\n/m, '').replace(/\r\n/m, '');
+ }
+ });
+ });
- function n(text) {
- return text.replace(/\r\n/m, '').replace(/\r\n/m, '');
+ it('should destroy the previous leave animation if a new one takes place', function() {
+ module(function($provide) {
+ $provide.value('$animate', {
+ enabled : function() { return true; },
+ leave : function() {
+ //DOM operation left blank
+ },
+ enter : function(element, parent, after) {
+ angular.element(after).after(element);
}
});
});
+ inject(function ($compile, $rootScope, $animate, $location) {
+ var item;
+ var $scope = $rootScope.$new();
+ element = $compile(html(
+ ''
+ ))($scope);
- it('should destroy the previous leave animation if a new one takes place', function() {
- module(function($provide) {
- $provide.value('$animate', {
- enabled : function() { return true; },
- leave : function() {
- //DOM operation left blank
- },
- enter : function(element, parent, after) {
- angular.element(after).after(element);
- }
- });
- });
- inject(function ($compile, $rootScope, $animate, $location) {
- var item;
- var $scope = $rootScope.$new();
- element = $compile(html(
- ''
- ))($scope);
-
- $scope.$apply('value = true');
-
- $location.path('/bar');
- $rootScope.$digest();
+ $scope.$apply('value = true');
- var destroyed, inner = element.children(0);
- inner.on('$destroy', function() {
- destroyed = true;
- });
+ $location.path('/bar');
+ $rootScope.$digest();
- $location.path('/foo');
- $rootScope.$digest();
+ var destroyed, inner = element.children(0);
+ inner.on('$destroy', function() {
+ destroyed = true;
+ });
- $location.path('/bar');
- $rootScope.$digest();
+ $location.path('/foo');
+ $rootScope.$digest();
- $location.path('/bar');
- $rootScope.$digest();
+ $location.path('/bar');
+ $rootScope.$digest();
- expect(destroyed).toBe(true);
- });
+ $location.path('/bar');
+ $rootScope.$digest();
+
+ expect(destroyed).toBe(true);
});
});
+ });
describe('autoscroll', function () {
@@ -964,20 +971,21 @@ describe('ngView animations', function() {
it('should only call $anchorScroll after the "enter" animation completes', inject(
- compileAndLink('
'),
- function($rootScope, $location, $animate, $timeout) {
- $location.path('/foo');
+ compileAndLink('
'),
+ function($rootScope, $location, $animate, $timeout) {
+ $location.path('/foo');
- expect($animate.enter).not.toHaveBeenCalled();
- $rootScope.$digest();
+ expect($animate.enter).not.toHaveBeenCalled();
+ $rootScope.$digest();
- expect(autoScrollSpy).not.toHaveBeenCalled();
+ expect(autoScrollSpy).not.toHaveBeenCalled();
- expect($animate.queue.shift().event).toBe('enter');
- $animate.triggerCallbacks();
+ expect($animate.queue.shift().event).toBe('enter');
+ $animate.triggerCallbacks();
- expect($animate.enter).toHaveBeenCalledOnce();
- expect(autoScrollSpy).toHaveBeenCalledOnce();
- }));
+ expect($animate.enter).toHaveBeenCalledOnce();
+ expect(autoScrollSpy).toHaveBeenCalledOnce();
+ }
+ ));
});
});
diff --git a/test/ngRoute/routeSpec.js b/test/ngRoute/routeSpec.js
index de7ccb8d593d..8584fb0c7909 100644
--- a/test/ngRoute/routeSpec.js
+++ b/test/ngRoute/routeSpec.js
@@ -560,8 +560,8 @@ describe('$route', function() {
inject(function($route, $httpBackend, $location, $rootScope) {
var log = '';
- $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before(' + next.templateUrl + ');'});
- $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after(' + next.templateUrl + ');'});
+ $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before(' + next.templateUrl + ');'; });
+ $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after(' + next.templateUrl + ');'; });
$httpBackend.expectGET('r1.html').respond('R1');
$httpBackend.expectGET('r2.html').respond('R2');
@@ -581,9 +581,9 @@ describe('$route', function() {
});
it('should NOT load cross domain templates by default', function() {
- module(function($routeProvider) {
- $routeProvider.when('/foo', { templateUrl: 'http://example.com/foo.html' });
- });
+ module(function($routeProvider) {
+ $routeProvider.when('/foo', { templateUrl: 'http://example.com/foo.html' });
+ });
inject(function ($route, $location, $rootScope) {
$location.path('/foo');
@@ -618,8 +618,8 @@ describe('$route', function() {
inject(function($route, $httpBackend, $location, $rootScope, $routeParams) {
var log = '';
- $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before' + angular.toJson($routeParams) + ';'});
- $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after' + angular.toJson($routeParams) + ';'});
+ $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before' + angular.toJson($routeParams) + ';'; });
+ $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after' + angular.toJson($routeParams) + ';'; });
$httpBackend.whenGET('r1.html').respond('R1');
$httpBackend.whenGET('r2.html').respond('R2');
@@ -650,8 +650,8 @@ describe('$route', function() {
inject(function($route, $httpBackend, $location, $rootScope) {
var log = '';
- $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before(' + next.templateUrl + ');'});
- $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after(' + next.templateUrl + ');'});
+ $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before(' + next.templateUrl + ');'; });
+ $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after(' + next.templateUrl + ');'; });
$httpBackend.expectGET('r1.html').respond('R1');
$httpBackend.expectGET('r2.html').respond('R2');
@@ -683,8 +683,8 @@ describe('$route', function() {
$rootScope.$on('$routeChangeError', function(e, next, last, error) {
log += '$failed(' + next.templateUrl + ', ' + error.status + ');';
});
- $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before(' + next.templateUrl + ');'});
- $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after(' + next.templateUrl + ');'});
+ $rootScope.$on('$routeChangeStart', function(e, next) { log += '$before(' + next.templateUrl + ');'; });
+ $rootScope.$on('$routeChangeSuccess', function(e, next) { log += '$after(' + next.templateUrl + ');'; });
$httpBackend.expectGET('r1.html').respond(404, 'R1');
$httpBackend.expectGET('r2.html').respond('R2');
diff --git a/test/ngSanitize/filter/linkySpec.js b/test/ngSanitize/filter/linkySpec.js
index a3ef20708588..b01a34c7bc0e 100644
--- a/test/ngSanitize/filter/linkySpec.js
+++ b/test/ngSanitize/filter/linkySpec.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('linky', function() {
var linky;
@@ -27,8 +29,8 @@ describe('linky', function() {
it('should handle target:', function() {
expect(linky("http://example.com", "_blank")).
- toEqual('http://example.com ')
+ toEqual('http://example.com ');
expect(linky("http://example.com", "someNamedIFrame")).
- toEqual('http://example.com ')
+ toEqual('http://example.com ');
});
});
diff --git a/test/ngSanitize/sanitizeSpec.js b/test/ngSanitize/sanitizeSpec.js
index fbffbba5cbeb..43cec4cdd710 100644
--- a/test/ngSanitize/sanitizeSpec.js
+++ b/test/ngSanitize/sanitizeSpec.js
@@ -16,32 +16,33 @@ describe('HTML', function() {
});
describe('htmlParser', function() {
+ /* global htmlParser */
if (angular.isUndefined(window.htmlParser)) return;
var handler, start, text, comment;
beforeEach(function() {
handler = {
- start: function(tag, attrs, unary){
- start = {
- tag: tag,
- attrs: attrs,
- unary: unary
- };
- // Since different browsers handle newlines differently we trim
- // so that it is easier to write tests.
- angular.forEach(attrs, function(value, key) {
- attrs[key] = value.replace(/^\s*/, '').replace(/\s*$/, '')
- });
- },
- chars: function(text_){
- text = text_;
- },
- end:function(tag) {
- expect(tag).toEqual(start.tag);
- },
- comment:function(comment_) {
- comment = comment_;
- }
+ start: function(tag, attrs, unary){
+ start = {
+ tag: tag,
+ attrs: attrs,
+ unary: unary
+ };
+ // Since different browsers handle newlines differently we trim
+ // so that it is easier to write tests.
+ angular.forEach(attrs, function(value, key) {
+ attrs[key] = value.replace(/^\s*/, '').replace(/\s*$/, '');
+ });
+ },
+ chars: function(text_){
+ text = text_;
+ },
+ end:function(tag) {
+ expect(tag).toEqual(start.tag);
+ },
+ comment:function(comment_) {
+ comment = comment_;
+ }
};
});
@@ -191,10 +192,11 @@ describe('HTML', function() {
});
it('should allow multiline strings', function() {
- expectHTML('\na\n').toEqual('
a\
');
+ expectHTML('\na\n').toEqual('
a
');
});
describe('htmlSanitizerWriter', function() {
+ /* global htmlSanitizeWriter: false */
if (angular.isUndefined(window.htmlSanitizeWriter)) return;
var writer, html, uriValidator;
@@ -366,11 +368,13 @@ describe('HTML', function() {
});
it('should not be URI', function() {
+ /* jshint scripturl: true */
expect('javascript:alert').not.toBeValidUrl();
});
describe('javascript URLs', function() {
it('should ignore javascript:', function() {
+ /* jshint scripturl: true */
expect('JavaScript:abc').not.toBeValidUrl();
expect(' \n Java\n Script:abc').not.toBeValidUrl();
expect('http://JavaScript/my.js').toBeValidUrl();
@@ -406,6 +410,7 @@ describe('HTML', function() {
});
describe('sanitizeText', function() {
+ /* global sanitizeText: false */
it('should escape text', function() {
expect(sanitizeText('a&
c')).toEqual('a<div>&</div>c');
});
diff --git a/test/ngScenario/ApplicationSpec.js b/test/ngScenario/ApplicationSpec.js
index 4e99bbbd3fbb..b86a4e5eccdc 100644
--- a/test/ngScenario/ApplicationSpec.js
+++ b/test/ngScenario/ApplicationSpec.js
@@ -5,7 +5,7 @@ describe('angular.scenario.Application', function() {
var app, frames;
function callLoadHandlers(app) {
- var handler = app.getFrame_().triggerHandler('load')
+ var handler = app.getFrame_().triggerHandler('load');
}
beforeEach(function() {
diff --git a/test/ngScenario/RunnerSpec.js b/test/ngScenario/RunnerSpec.js
index c4ad6f95bbf7..9f62504409b1 100644
--- a/test/ngScenario/RunnerSpec.js
+++ b/test/ngScenario/RunnerSpec.js
@@ -71,7 +71,7 @@ describe('angular.scenario.Runner', function() {
$window.it('1', angular.noop);
$window.describe('B', function() {
$window.beforeEach(function() { before.push('B'); });
- $window.afterEach(function() { after.push('B'); });
+ $window.afterEach(function() { after.push('B'); });
$window.it('2', angular.noop);
$window.describe('C', function() {
$window.beforeEach(function() { before.push('C'); });
diff --git a/test/ngScenario/ScenarioSpec.js b/test/ngScenario/ScenarioSpec.js
index 898075cb2e75..68743c6c1e75 100644
--- a/test/ngScenario/ScenarioSpec.js
+++ b/test/ngScenario/ScenarioSpec.js
@@ -39,6 +39,6 @@ describe("ScenarioSpec: Compilation", function() {
var jQuery = angular.scenario.jQuery;
expect(typeof jQuery).toEqual('function');
expect(typeof jQuery('
').html).toEqual('function');
- })
+ });
});
});
diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js
index 2553fadd65b1..80d4165bd9ef 100644
--- a/test/ngScenario/dslSpec.js
+++ b/test/ngScenario/dslSpec.js
@@ -248,8 +248,8 @@ describe("angular.scenario.dsl", function() {
' one ' +
' '
);
- $root.dsl.select('test').option('one');
- expect(doc.find('[ng-model="test"]').val()).toEqual('D');
+ $root.dsl.select('test').option('one');
+ expect(doc.find('[ng-model="test"]').val()).toEqual('D');
});
it('should select option by name if no exact match and name contains value', function() {
@@ -260,8 +260,8 @@ describe("angular.scenario.dsl", function() {
' thirty one ' +
' '
);
- $root.dsl.select('test').option('one');
- expect(doc.find('[ng-model="test"]').val()).toEqual('A');
+ $root.dsl.select('test').option('one');
+ expect(doc.find('[ng-model="test"]').val()).toEqual('A');
});
it('should select multiple options', function() {
@@ -283,14 +283,14 @@ describe("angular.scenario.dsl", function() {
});
it('should fail to select an option that does not exist', function(){
- doc.append(
- '' +
- ' one ' +
- ' two ' +
- ' '
- );
- $root.dsl.select('test').option('three');
- expect($root.futureError).toMatch(/not found/);
+ doc.append(
+ '' +
+ ' one ' +
+ ' two ' +
+ ' '
+ );
+ $root.dsl.select('test').option('three');
+ expect($root.futureError).toMatch(/not found/);
});
});
diff --git a/test/ngScenario/e2e/widgets-scenario.js b/test/ngScenario/e2e/widgets-scenario.js
index fda9b3c6075e..9d9429c3ed25 100644
--- a/test/ngScenario/e2e/widgets-scenario.js
+++ b/test/ngScenario/e2e/widgets-scenario.js
@@ -1,3 +1,4 @@
+/* global using: false, binding: false, input: false, select: false, repeater: false */
'use strict';
describe('widgets', function() {
diff --git a/test/ngScenario/output/HtmlSpec.js b/test/ngScenario/output/HtmlSpec.js
index 442e596dd9f3..e5d6e9e78d42 100644
--- a/test/ngScenario/output/HtmlSpec.js
+++ b/test/ngScenario/output/HtmlSpec.js
@@ -109,7 +109,8 @@ describe('angular.scenario.output.html', function() {
context.find('#describe-10 .tests > li .test-info .timer-result').
each(function(index, timer) {
expect(timer.innerHTML).toMatch(/ms$/);
- });
+ }
+ );
});
it('should include line if provided', function() {
diff --git a/test/ngTouch/directive/ngSwipeSpec.js b/test/ngTouch/directive/ngSwipeSpec.js
index b46a9384e5f9..9ee0411348d3 100644
--- a/test/ngTouch/directive/ngSwipeSpec.js
+++ b/test/ngTouch/directive/ngSwipeSpec.js
@@ -220,7 +220,7 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent,
expect(eventFired).toEqual(true);
}));
});
-}
+};
swipeTests('touch', /* restrictBrowers */ true, 'touchstart', 'touchmove', 'touchend');
swipeTests('mouse', /* restrictBrowers */ false, 'mousedown', 'mousemove', 'mouseup');
diff --git a/test/ngTouch/swipeSpec.js b/test/ngTouch/swipeSpec.js
index 1eb53e45d619..f770651ec265 100644
--- a/test/ngTouch/swipeSpec.js
+++ b/test/ngTouch/swipeSpec.js
@@ -385,7 +385,7 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent,
expect(events.end).not.toHaveBeenCalled();
}));
});
-}
+};
swipeTests('touch', /* restrictBrowers */ true, 'touchstart', 'touchmove', 'touchend');
swipeTests('mouse', /* restrictBrowers */ false, 'mousedown', 'mousemove', 'mouseup');