diff options
Diffstat (limited to 'test')
43 files changed, 552 insertions, 551 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 0332c01b..5b0a3466 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -1,8 +1,8 @@ 'use strict'; -describe('angular', function(){ - describe('case', function(){ - it('should change case', function(){ +describe('angular', function() { + describe('case', function() { + it('should change case', function() { expect(lowercase('ABC90')).toEqual('abc90'); expect(manualLowercase('ABC90')).toEqual('abc90'); expect(uppercase('abc90')).toEqual('ABC90'); @@ -10,22 +10,22 @@ describe('angular', function(){ }); }); - describe("copy", function(){ - it("should return same object", function (){ + describe("copy", function() { + it("should return same object", function () { var obj = {}; var arr = []; expect(copy({}, obj)).toBe(obj); expect(copy([], arr)).toBe(arr); }); - it("should copy Date", function(){ + it("should copy Date", function() { var date = new Date(123); expect(copy(date) instanceof Date).toBeTruthy(); expect(copy(date).getTime()).toEqual(123); expect(copy(date) === date).toBeFalsy(); }); - it("should copy array", function(){ + it("should copy array", function() { var src = [1, {name:"value"}]; var dst = [{key:"v"}]; expect(copy(src, dst)).toBe(dst); @@ -41,7 +41,7 @@ describe('angular', function(){ expect(dst).toEqual([]); }); - it("should copy object", function(){ + it("should copy object", function() { var src = {a:{name:"value"}}; var dst = {b:{key:"v"}}; expect(copy(src, dst)).toBe(dst); @@ -50,7 +50,7 @@ describe('angular', function(){ expect(dst.a).not.toBe(src.a); }); - it("should copy primitives", function(){ + it("should copy primitives", function() { expect(copy(null)).toEqual(null); expect(copy('')).toBe(''); expect(copy('lala')).toBe('lala'); @@ -59,8 +59,8 @@ describe('angular', function(){ }); }); - describe('equals', function(){ - it('should return true if same object', function(){ + describe('equals', function() { + it('should return true if same object', function() { var o = {}; expect(equals(o, o)).toEqual(true); expect(equals(o, {})).toEqual(true); @@ -68,7 +68,7 @@ describe('angular', function(){ expect(equals(1, '2')).toEqual(false); }); - it('should recurse into object', function(){ + it('should recurse into object', function() { expect(equals({}, {})).toEqual(true); expect(equals({name:'misko'}, {name:'misko'})).toEqual(true); expect(equals({name:'misko', age:1}, {name:'misko'})).toEqual(false); @@ -79,13 +79,13 @@ describe('angular', function(){ expect(equals(['misko'], ['misko', 'adam'])).toEqual(false); }); - it('should ignore $ member variables', function(){ + it('should ignore $ member variables', function() { expect(equals({name:'misko', $id:1}, {name:'misko', $id:2})).toEqual(true); expect(equals({name:'misko'}, {name:'misko', $id:2})).toEqual(true); expect(equals({name:'misko', $id:1}, {name:'misko'})).toEqual(true); }); - it('should ignore functions', function(){ + it('should ignore functions', function() { expect(equals({func: function() {}}, {bar: function() {}})).toEqual(true); }); @@ -169,8 +169,8 @@ describe('angular', function(){ }); }); - describe('sortedKeys', function(){ - it('should collect keys from object', function(){ + describe('sortedKeys', function() { + it('should collect keys from object', function() { expect(sortedKeys({c:0, b:0, a:0})).toEqual(['a', 'b', 'c']); }); }); @@ -524,14 +524,14 @@ describe('angular', function(){ }); }); - describe('compile', function(){ + describe('compile', function() { var scope, template; - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - it('should link to existing node and create scope', function(){ + it('should link to existing node and create scope', function() { template = angular.element('<div>{{greeting = "hello world"}}</div>'); scope = angular.compile(template)(); scope.$digest(); @@ -539,7 +539,7 @@ describe('angular', function(){ expect(scope.greeting).toEqual('hello world'); }); - it('should link to existing node and given scope', function(){ + it('should link to existing node and given scope', function() { scope = angular.scope(); template = angular.element('<div>{{greeting = "hello world"}}</div>'); angular.compile(template)(scope); @@ -548,7 +548,7 @@ describe('angular', function(){ expect(scope).toEqual(scope); }); - it('should link to new node and given scope', function(){ + it('should link to new node and given scope', function() { scope = angular.scope(); template = jqLite('<div>{{greeting = "hello world"}}</div>'); @@ -566,7 +566,7 @@ describe('angular', function(){ expect(scope.greeting).toEqual('hello world'); }); - it('should link to cloned node and create scope', function(){ + it('should link to cloned node and create scope', function() { scope = angular.scope(); template = jqLite('<div>{{greeting = "hello world"}}</div>'); angular.compile(template)(scope, noop).$digest(); @@ -598,8 +598,8 @@ describe('angular', function(){ }); - describe('nextUid()', function(){ - it('should return new id per call', function(){ + describe('nextUid()', function() { + it('should return new id per call', function() { var seen = {}; var count = 100; diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js index bd77d734..208169df 100644 --- a/test/ApiSpecs.js +++ b/test/ApiSpecs.js @@ -16,7 +16,7 @@ describe('api', function() { expect(map.get(key)).toBe(undefined); }); - it('should init from an array', function(){ + it('should init from an array', function() { var map = new HashMap(['a','b']); expect(map.get('a')).toBe(0); expect(map.get('b')).toBe(1); diff --git a/test/BinderSpec.js b/test/BinderSpec.js index fa7fde60..bdeed675 100644 --- a/test/BinderSpec.js +++ b/test/BinderSpec.js @@ -1,7 +1,7 @@ 'use strict'; -describe('Binder', function(){ - beforeEach(function(){ +describe('Binder', function() { + beforeEach(function() { var self = this; this.compile = function(html, parent, logErrors) { @@ -22,42 +22,42 @@ describe('Binder', function(){ }; }); - afterEach(function(){ + afterEach(function() { if (this.element && this.element.dealoc) { this.element.dealoc(); } }); - it('BindUpdate', function(){ + it('BindUpdate', function() { var scope = this.compile('<div ng:init="a=123"/>'); scope.$digest(); assertEquals(123, scope.a); }); - it('ExecuteInitialization', function(){ + it('ExecuteInitialization', function() { var scope = this.compile('<div ng:init="a=123">'); assertEquals(scope.a, 123); }); - it('ExecuteInitializationStatements', function(){ + it('ExecuteInitializationStatements', function() { var scope = this.compile('<div ng:init="a=123;b=345">'); assertEquals(scope.a, 123); assertEquals(scope.b, 345); }); - it('ApplyTextBindings', function(){ + it('ApplyTextBindings', function() { var scope = this.compile('<div ng:bind="model.a">x</div>'); scope.model = {a:123}; scope.$apply(); assertEquals('123', scope.$element.text()); }); - it('ReplaceBindingInTextWithSpan', function(){ + it('ReplaceBindingInTextWithSpan', function() { assertEquals(this.compileToHtml("<b>a{{b}}c</b>"), '<b>a<span ng:bind="b"></span>c</b>'); assertEquals(this.compileToHtml("<b>{{b}}</b>"), '<b><span ng:bind="b"></span></b>'); }); - it('BindingSpaceConfusesIE', function(){ + it('BindingSpaceConfusesIE', function() { if (!msie) return; var span = document.createElement("span"); span.innerHTML = ' '; @@ -70,7 +70,7 @@ describe('Binder', function(){ this.compileToHtml("<b>{{A}} x {{B}} ({{C}})</b>")); }); - it('BindingOfAttributes', function(){ + it('BindingOfAttributes', function() { var scope = this.compile("<a href='http://s/a{{b}}c' foo='x'></a>"); var attrbinding = scope.$element.attr("ng:bind-attr"); var bindings = fromJson(attrbinding); @@ -78,7 +78,7 @@ describe('Binder', function(){ assertTrue(!bindings.foo); }); - it('MarkMultipleAttributes', function(){ + it('MarkMultipleAttributes', function() { var scope = this.compile('<a href="http://s/a{{b}}c" foo="{{d}}"></a>'); var attrbinding = scope.$element.attr("ng:bind-attr"); var bindings = fromJson(attrbinding); @@ -86,20 +86,20 @@ describe('Binder', function(){ assertEquals(decodeURI(bindings.href), "http://s/a{{b}}c"); }); - it('AttributesNoneBound', function(){ + it('AttributesNoneBound', function() { var scope = this.compile("<a href='abc' foo='def'></a>"); var a = scope.$element; assertEquals(a[0].nodeName, "A"); assertTrue(!a.attr("ng:bind-attr")); }); - it('ExistingAttrbindingIsAppended', function(){ + it('ExistingAttrbindingIsAppended', function() { var scope = this.compile("<a href='http://s/{{abc}}' ng:bind-attr='{\"b\":\"{{def}}\"}'></a>"); var a = scope.$element; assertEquals('{"b":"{{def}}","href":"http://s/{{abc}}"}', a.attr('ng:bind-attr')); }); - it('AttributesAreEvaluated', function(){ + it('AttributesAreEvaluated', function() { var scope = this.compile('<a ng:bind-attr=\'{"a":"a", "b":"a+b={{a+b}}"}\'></a>'); scope.$eval('a=1;b=2'); scope.$apply(); @@ -108,21 +108,21 @@ describe('Binder', function(){ assertEquals(a.attr('b'), 'a+b=3'); }); - it('InputTypeButtonActionExecutesInScope', function(){ + it('InputTypeButtonActionExecutesInScope', function() { var savedCalled = false; var scope = this.compile('<input type="button" ng:click="person.save()" value="Apply">'); scope.person = {}; - scope.person.save = function(){ + scope.person.save = function() { savedCalled = true; }; browserTrigger(scope.$element, 'click'); assertTrue(savedCalled); }); - it('InputTypeButtonActionExecutesInScope2', function(){ + it('InputTypeButtonActionExecutesInScope2', function() { var log = ""; var scope = this.compile('<input type="image" ng:click="action()">'); - scope.action = function(){ + scope.action = function() { log += 'click;'; }; expect(log).toEqual(''); @@ -130,18 +130,18 @@ describe('Binder', function(){ expect(log).toEqual('click;'); }); - it('ButtonElementActionExecutesInScope', function(){ + it('ButtonElementActionExecutesInScope', function() { var savedCalled = false; var scope = this.compile('<button ng:click="person.save()">Apply</button>'); scope.person = {}; - scope.person.save = function(){ + scope.person.save = function() { savedCalled = true; }; browserTrigger(scope.$element, 'click'); assertTrue(savedCalled); }); - it('RepeaterUpdateBindings', function(){ + it('RepeaterUpdateBindings', function() { var scope = this.compile('<ul><LI ng:repeat="item in model.items" ng:bind="item.a"/></ul>'); var form = scope.$element; var items = [{a:"A"}, {a:"B"}]; @@ -176,7 +176,7 @@ describe('Binder', function(){ scope.$apply(); }); - it('RepeaterContentDoesNotBind', function(){ + it('RepeaterContentDoesNotBind', function() { var scope = this.compile('<ul><LI ng:repeat="item in model.items"><span ng:bind="item.a"></span></li></ul>'); scope.model = {items:[{a:"A"}]}; scope.$apply(); @@ -186,12 +186,12 @@ describe('Binder', function(){ '</ul>', sortedHtml(scope.$element)); }); - it('DoNotOverwriteCustomAction', function(){ + it('DoNotOverwriteCustomAction', function() { var html = this.compileToHtml('<input type="submit" value="Save" action="foo();">'); assertTrue(html.indexOf('action="foo();"') > 0 ); }); - it('RepeaterAdd', function(){ + it('RepeaterAdd', function() { var scope = this.compile('<div><input type="text" ng:model="item.x" ng:repeat="item in items"></div>'); scope.items = [{x:'a'}, {x:'b'}]; scope.$apply(); @@ -206,7 +206,7 @@ describe('Binder', function(){ expect(scope.items[0].x).toEqual('ABC'); }); - it('ItShouldRemoveExtraChildrenWhenIteratingOverHash', function(){ + it('ItShouldRemoveExtraChildrenWhenIteratingOverHash', function() { var scope = this.compile('<div><div ng:repeat="i in items">{{i}}</div></div>'); var items = {}; scope.items = items; @@ -223,44 +223,44 @@ describe('Binder', function(){ expect(scope.$element[0].childNodes.length - 1).toEqual(0); }); - it('IfTextBindingThrowsErrorDecorateTheSpan', function(){ + it('IfTextBindingThrowsErrorDecorateTheSpan', function() { var scope = this.compile('<div>{{error.throw()}}</div>', null, true); var errorLogs = scope.$service('$exceptionHandler').errors; scope.error = { - 'throw': function(){throw "ErrorMsg1";} + 'throw': function() {throw "ErrorMsg1";} }; scope.$apply(); - scope.error['throw'] = function(){throw "MyError";}; + scope.error['throw'] = function() {throw "MyError";}; errorLogs.length = 0; scope.$apply(); assertEquals(['MyError'], errorLogs.shift()); - scope.error['throw'] = function(){return "ok";}; + scope.error['throw'] = function() {return "ok";}; scope.$apply(); assertEquals(0, errorLogs.length); }); - it('IfAttrBindingThrowsErrorDecorateTheAttribute', function(){ + it('IfAttrBindingThrowsErrorDecorateTheAttribute', function() { var scope = this.compile('<div attr="before {{error.throw()}} after"></div>', null, true); var errorLogs = scope.$service('$exceptionHandler').errors; var count = 0; scope.error = { - 'throw': function(){throw new Error("ErrorMsg" + (++count));} + 'throw': function() {throw new Error("ErrorMsg" + (++count));} }; scope.$apply(); expect(errorLogs.length).not.toEqual(0); expect(errorLogs.shift()).toMatch(/ErrorMsg1/); errorLogs.length = 0; - scope.error['throw'] = function(){ return 'X';}; + scope.error['throw'] = function() { return 'X';}; scope.$apply(); expect(errorLogs.length).toMatch(0); }); - it('NestedRepeater', function(){ + it('NestedRepeater', function() { var scope = this.compile('<div><div ng:repeat="m in model" name="{{m.name}}">' + '<ul name="{{i}}" ng:repeat="i in m.item"></ul>' + '</div></div>'); @@ -282,7 +282,7 @@ describe('Binder', function(){ '</div></div>', sortedHtml(scope.$element)); }); - it('HideBindingExpression', function(){ + it('HideBindingExpression', function() { var scope = this.compile('<div ng:hide="hidden == 3"/>'); scope.hidden = 3; @@ -296,7 +296,7 @@ describe('Binder', function(){ assertVisible(scope.$element); }); - it('HideBinding', function(){ + it('HideBinding', function() { var scope = this.compile('<div ng:hide="hidden"/>'); scope.hidden = 'true'; @@ -315,7 +315,7 @@ describe('Binder', function(){ assertVisible(scope.$element); }); - it('ShowBinding', function(){ + it('ShowBinding', function() { var scope = this.compile('<div ng:show="show"/>'); scope.show = 'true'; @@ -335,7 +335,7 @@ describe('Binder', function(){ }); - it('BindClass', function(){ + it('BindClass', function() { var scope = this.compile('<div ng:class="clazz"/>'); scope.clazz = 'testClass'; @@ -349,7 +349,7 @@ describe('Binder', function(){ assertEquals('<div class="a b" ng:class="clazz"></div>', sortedHtml(scope.$element)); }); - it('BindClassEvenOdd', function(){ + it('BindClassEvenOdd', function() { var scope = this.compile('<div><div ng:repeat="i in [0,1]" ng:class-even="\'e\'" ng:class-odd="\'o\'"></div></div>'); scope.$apply(); var d1 = jqLite(scope.$element[0].childNodes[1]); @@ -363,7 +363,7 @@ describe('Binder', function(){ sortedHtml(scope.$element)); }); - it('BindStyle', function(){ + it('BindStyle', function() { var scope = this.compile('<div ng:style="style"/>'); scope.$eval('style={height: "10px"}'); @@ -375,9 +375,9 @@ describe('Binder', function(){ scope.$apply(); }); - it('ActionOnAHrefThrowsError', function(){ + it('ActionOnAHrefThrowsError', function() { var scope = this.compile('<a ng:click="action()">Add Phone</a>', null, true); - scope.action = function(){ + scope.action = function() { throw new Error('MyError'); }; var input = scope.$element; @@ -385,7 +385,7 @@ describe('Binder', function(){ expect(scope.$service('$exceptionHandler').errors[0]).toMatch(/MyError/); }); - it('ShoulIgnoreVbNonBindable', function(){ + it('ShoulIgnoreVbNonBindable', function() { var scope = this.compile("<div>{{a}}" + "<div ng:non-bindable>{{a}}</div>" + "<div ng:non-bindable=''>{{b}}</div>" + @@ -403,7 +403,7 @@ describe('Binder', function(){ assertEquals('<pre ng:bind-template="Hello {{name}}!">Hello World!</pre>', sortedHtml(scope.$element)); }); - it('FillInOptionValueWhenMissing', function(){ + it('FillInOptionValueWhenMissing', function() { var scope = this.compile( '<select ng:model="foo">' + '<option selected="true">{{a}}</option>' + @@ -427,7 +427,7 @@ describe('Binder', function(){ expect(optionC.text()).toEqual('C'); }); - it('DeleteAttributeIfEvaluatesFalse', function(){ + it('DeleteAttributeIfEvaluatesFalse', function() { var scope = this.compile('<div>' + '<input ng:model="a0" ng:bind-attr="{disabled:\'{{true}}\'}">' + '<input ng:model="a1" ng:bind-attr="{disabled:\'{{false}}\'}">' + @@ -449,7 +449,7 @@ describe('Binder', function(){ assertChild(5, false); }); - it('ItShouldDisplayErrorWhenActionIsSyntacticlyIncorrect', function(){ + it('ItShouldDisplayErrorWhenActionIsSyntacticlyIncorrect', function() { var scope = this.compile('<div>' + '<input type="button" ng:click="greeting=\'ABC\'"/>' + '<input type="button" ng:click=":garbage:"/></div>', null, true); @@ -466,7 +466,7 @@ describe('Binder', function(){ toMatchError(/Syntax Error: Token ':' not a primary expression/); }); - it('ItShouldSelectTheCorrectRadioBox', function(){ + it('ItShouldSelectTheCorrectRadioBox', function() { var scope = this.compile('<div>' + '<input type="radio" ng:model="sex" value="female">' + '<input type="radio" ng:model="sex" value="male"></div>'); @@ -486,7 +486,7 @@ describe('Binder', function(){ assertEquals("male", male.val()); }); - it('ItShouldRepeatOnHashes', function(){ + it('ItShouldRepeatOnHashes', function() { var scope = this.compile('<ul><li ng:repeat="(k,v) in {a:0,b:1}" ng:bind=\"k + v\"></li></ul>'); scope.$apply(); assertEquals('<ul>' + @@ -497,7 +497,7 @@ describe('Binder', function(){ sortedHtml(scope.$element)); }); - it('ItShouldFireChangeListenersBeforeUpdate', function(){ + it('ItShouldFireChangeListenersBeforeUpdate', function() { var scope = this.compile('<div ng:bind="name"></div>'); scope.name = ""; scope.$watch("watched", "name=123"); @@ -509,7 +509,7 @@ describe('Binder', function(){ sortedHtml(scope.$element)); }); - it('ItShouldHandleMultilineBindings', function(){ + it('ItShouldHandleMultilineBindings', function() { var scope = this.compile('<div>{{\n 1 \n + \n 2 \n}}</div>'); scope.$apply(); assertEquals("3", scope.$element.text()); diff --git a/test/BrowserSpecs.js b/test/BrowserSpecs.js index 692bc5ae..511bb643 100644 --- a/test/BrowserSpecs.js +++ b/test/BrowserSpecs.js @@ -46,11 +46,11 @@ function MockWindow() { }; } -describe('browser', function(){ +describe('browser', function() { var browser, fakeWindow, xhr, logs, scripts, removedScripts, sniffer; - beforeEach(function(){ + beforeEach(function() { scripts = []; removedScripts = []; xhr = null; @@ -60,7 +60,7 @@ describe('browser', function(){ var fakeBody = [{appendChild: function(node){scripts.push(node);}, removeChild: function(node){removedScripts.push(node);}}]; - var FakeXhr = function(){ + var FakeXhr = function() { xhr = this; this.open = function(method, url, async){ xhr.method = method; @@ -91,14 +91,14 @@ describe('browser', function(){ expect(browser.cookies).toBeDefined(); }); - describe('outstading requests', function(){ - it('should process callbacks immedietly with no outstanding requests', function(){ + describe('outstading requests', function() { + it('should process callbacks immedietly with no outstanding requests', function() { var callback = jasmine.createSpy('callback'); browser.notifyWhenNoOutstandingRequests(callback); expect(callback).toHaveBeenCalled(); }); - it('should queue callbacks with outstanding requests', function(){ + it('should queue callbacks with outstanding requests', function() { var callback = jasmine.createSpy('callback'); browser.xhr('GET', '/url', null, noop); browser.notifyWhenNoOutstandingRequests(callback); @@ -110,8 +110,8 @@ describe('browser', function(){ }); }); - describe('xhr', function(){ - describe('JSON', function(){ + describe('xhr', function() { + describe('JSON', function() { var log; function callback(code, data) { @@ -478,12 +478,12 @@ describe('browser', function(){ }); - describe('poller', function(){ + describe('poller', function() { - it('should call functions in pollFns in regular intervals', function(){ + it('should call functions in pollFns in regular intervals', function() { var log = ''; - browser.addPollFn(function(){log+='a';}); - browser.addPollFn(function(){log+='b';}); + browser.addPollFn(function() {log+='a';}); + browser.addPollFn(function() {log+='b';}); expect(log).toEqual(''); fakeWindow.setTimeout.flush(); expect(log).toEqual('ab'); @@ -491,14 +491,14 @@ describe('browser', function(){ expect(log).toEqual('abab'); }); - it('should startPoller', function(){ + it('should startPoller', function() { expect(fakeWindow.timeouts.length).toEqual(0); - browser.addPollFn(function(){}); + browser.addPollFn(function() {}); expect(fakeWindow.timeouts.length).toEqual(1); //should remain 1 as it is the check fn - browser.addPollFn(function(){}); + browser.addPollFn(function() {}); expect(fakeWindow.timeouts.length).toEqual(1); }); diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index f0045aa8..e0dcafc0 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -1,9 +1,9 @@ 'use strict'; -describe('compiler', function(){ +describe('compiler', function() { var compiler, markup, attrMarkup, directives, widgets, compile, log, scope; - beforeEach(function(){ + beforeEach(function() { log = ""; directives = { hello: function(expression, element){ @@ -34,13 +34,13 @@ describe('compiler', function(){ }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - it('should not allow compilation of multiple roots', function(){ - expect(function(){ + it('should not allow compilation of multiple roots', function() { + expect(function() { compiler.compile('<div>A</div><span></span>'); }).toThrow("Cannot compile multiple element roots: " + ie("<div>A</div><span></span>")); function ie(text) { @@ -49,7 +49,7 @@ describe('compiler', function(){ }); - it('should recognize a directive', function(){ + it('should recognize a directive', function() { var e = jqLite('<div directive="expr" ignore="me"></div>'); directives.directive = function(expression, element){ log += "found"; @@ -67,13 +67,13 @@ describe('compiler', function(){ }); - it('should recurse to children', function(){ + it('should recurse to children', function() { scope = compile('<div><span hello="misko"/></div>'); expect(log).toEqual("hello misko"); }); - it('should observe scope', function(){ + it('should observe scope', function() { scope = compile('<span observe="name"></span>'); expect(log).toEqual(""); scope.$digest(); @@ -87,14 +87,14 @@ describe('compiler', function(){ }); - it('should prevent descend', function(){ - directives.stop = function(){ this.descend(false); }; + it('should prevent descend', function() { + directives.stop = function() { this.descend(false); }; scope = compile('<span hello="misko" stop="true"><span hello="adam"/></span>'); expect(log).toEqual("hello misko"); }); - it('should allow creation of templates', function(){ + it('should allow creation of templates', function() { directives.duplicate = function(expr, element){ element.replaceWith(document.createComment("marker")); element.removeAttr("duplicate"); @@ -119,7 +119,7 @@ describe('compiler', function(){ }); - it('should process markup before directives', function(){ + it('should process markup before directives', function() { markup.push(function(text, textNode, parentNode) { if (text == 'middle') { expect(textNode.text()).toEqual(text); @@ -133,7 +133,7 @@ describe('compiler', function(){ }); - it('should replace widgets', function(){ + it('should replace widgets', function() { widgets['NG:BUTTON'] = function(element) { expect(element.hasClass('ng-widget')).toEqual(true); element.replaceWith('<div>button</div>'); @@ -147,7 +147,7 @@ describe('compiler', function(){ }); - it('should use the replaced element after calling widget', function(){ + it('should use the replaced element after calling widget', function() { widgets['H1'] = function(element) { // HTML elements which are augmented by acting as widgets, should not be marked as so expect(element.hasClass('ng-widget')).toEqual(false); @@ -166,7 +166,7 @@ describe('compiler', function(){ }); - it('should allow multiple markups per text element', function(){ + it('should allow multiple markups per text element', function() { markup.push(function(text, textNode, parent){ var index = text.indexOf('---'); if (index > -1) { @@ -190,7 +190,7 @@ describe('compiler', function(){ }); - it('should add class for namespace elements', function(){ + it('should add class for namespace elements', function() { scope = compile('<ng:space>abc</ng:space>'); var space = jqLite(scope.$element[0].firstChild); expect(space.hasClass('ng-space')).toEqual(true); diff --git a/test/FiltersSpec.js b/test/FiltersSpec.js index 672540c5..5bf9df6f 100644 --- a/test/FiltersSpec.js +++ b/test/FiltersSpec.js @@ -6,7 +6,7 @@ describe('filter', function() { it('should called the filter when evaluating expression', function() { var scope = createScope(); - filter.fakeFilter = function(){}; + filter.fakeFilter = function() {}; spyOn(filter, 'fakeFilter'); scope.$eval('10|fakeFilter'); @@ -205,7 +205,7 @@ describe('filter', function() { }); }); - describe('date', function(){ + describe('date', function() { var morning = new TzDate(+5, '2010-09-03T12:05:08.000Z'); //7am var noon = new TzDate(+5, '2010-09-03T17:05:08.000Z'); //12pm diff --git a/test/InjectorSpec.js b/test/InjectorSpec.js index ab4f3437..2c6c102a 100644 --- a/test/InjectorSpec.js +++ b/test/InjectorSpec.js @@ -1,20 +1,20 @@ 'use strict'; -describe('injector', function(){ +describe('injector', function() { var providers; var cache; var injector; var scope; - beforeEach(function(){ + beforeEach(function() { providers = extensionMap({}, 'providers'); cache = {}; scope = {}; injector = createInjector(scope, providers, cache); }); - it("should return same instance from calling provider", function(){ - providers('text', function(){ return scope.name; }); + it("should return same instance from calling provider", function() { + providers('text', function() { return scope.name; }); scope.name = 'abc'; expect(injector('text')).toEqual('abc'); expect(cache.text).toEqual('abc'); @@ -22,9 +22,9 @@ describe('injector', function(){ expect(injector('text')).toEqual('abc'); }); - it("should call function", function(){ - providers('a', function(){return 1;}); - providers('b', function(){return 2;}); + it("should call function", function() { + providers('a', function() {return 1;}); + providers('b', function() {return 2;}); var args; function fn(a, b, c, d) { args = [this, a, b, c, d]; @@ -34,15 +34,15 @@ describe('injector', function(){ expect(args).toEqual([{name:'this'}, 1, 2, 3, 4]); }); - it('should inject providers', function(){ - providers('a', function(){return this.mi = 'Mi';}); + it('should inject providers', function() { + providers('a', function() {return this.mi = 'Mi';}); providers('b', function(mi){return this.name = mi+'sko';}, {$inject:['a']}); expect(injector('b')).toEqual('Misko'); expect(scope).toEqual({mi:'Mi', name:'Misko'}); }); - it('should resolve dependency graph and instantiate all services just once', function(){ + it('should resolve dependency graph and instantiate all services just once', function() { var log = []; // s1 @@ -54,12 +54,12 @@ describe('injector', function(){ // s6 - providers('s1', function(){ log.push('s1'); }, {$inject: ['s2', 's5', 's6']}); - providers('s2', function(){ log.push('s2'); }, {$inject: ['s3', 's4', 's5']}); - providers('s3', function(){ log.push('s3'); }, {$inject: ['s6']}); - providers('s4', function(){ log.push('s4'); }, {$inject: ['s3', 's5']}); - providers('s5', function(){ log.push('s5'); }); - providers('s6', function(){ log.push('s6'); }); + providers('s1', function() { log.push('s1'); }, {$inject: ['s2', 's5', 's6']}); + providers('s2', function() { log.push('s2'); }, {$inject: ['s3', 's4', 's5']}); + providers('s3', function() { log.push('s3'); }, {$inject: ['s6']}); + providers('s4', function() { log.push('s4'); }, {$inject: ['s3', 's5']}); + providers('s5', function() { log.push('s5'); }); + providers('s6', function() { log.push('s6'); }); injector('s1'); @@ -67,32 +67,32 @@ describe('injector', function(){ }); - it('should provide usefull message if no provider', function(){ - expect(function(){ + it('should provide usefull message if no provider', function() { + expect(function() { injector('idontexist'); }).toThrow("Unknown provider for 'idontexist'."); }); - it('should autostart eager services', function(){ + it('should autostart eager services', function() { var log = ''; - providers('eager', function(){log += 'eager;'; return 'foo';}, {$eager: true}); + providers('eager', function() {log += 'eager;'; return 'foo';}, {$eager: true}); injector.eager(); expect(log).toEqual('eager;'); expect(injector('eager')).toBe('foo'); }); - describe('annotation', function(){ - it('should return $inject', function(){ - function fn(){} + describe('annotation', function() { + it('should return $inject', function() { + function fn() {} fn.$inject = ['a']; expect(inferInjectionArgs(fn)).toBe(fn.$inject); - expect(inferInjectionArgs(function(){})).toEqual([]); - expect(inferInjectionArgs(function (){})).toEqual([]); - expect(inferInjectionArgs(function (){})).toEqual([]); - expect(inferInjectionArgs(function /* */ (){})).toEqual([]); + expect(inferInjectionArgs(function() {})).toEqual([]); + expect(inferInjectionArgs(function () {})).toEqual([]); + expect(inferInjectionArgs(function () {})).toEqual([]); + expect(inferInjectionArgs(function /* */ () {})).toEqual([]); }); - it('should create $inject', function(){ + it('should create $inject', function() { // keep the multi-line to make sure we can handle it function $f_n0 /* */( @@ -107,40 +107,40 @@ describe('injector', function(){ expect($f_n0.$inject).toEqual(['$a', 'b_', '_c', 'd']); }); - it('should handle no arg functions', function(){ - function $f_n0(){} + it('should handle no arg functions', function() { + function $f_n0() {} expect(inferInjectionArgs($f_n0)).toEqual([]); expect($f_n0.$inject).toEqual([]); }); - it('should handle args with both $ and _', function(){ + it('should handle args with both $ and _', function() { function $f_n0($a_){} expect(inferInjectionArgs($f_n0)).toEqual(['$a_']); expect($f_n0.$inject).toEqual(['$a_']); }); - it('should throw on non function arg', function(){ - expect(function(){ + it('should throw on non function arg', function() { + expect(function() { inferInjectionArgs({}); }).toThrow(); }); - it('should infer injection on services', function(){ + it('should infer injection on services', function() { var scope = angular.scope({ - a: function(){ return 'a';}, + a: function() { return 'a';}, b: function(a){ return a + 'b';} }); expect(scope.$service('b')).toEqual('ab'); }); }); - describe('inject', function(){ - it('should inject names', function(){ + describe('inject', function() { + it('should inject names', function() { expect(annotate('a', {}).$inject).toEqual(['a']); expect(annotate('a', 'b', {}).$inject).toEqual(['a', 'b']); }); - it('should inject array', function(){ + it('should inject array', function() { expect(annotate(['a'], {}).$inject).toEqual(['a']); expect(annotate(['a', 'b'], {}).$inject).toEqual(['a', 'b']); }); diff --git a/test/JsonSpec.js b/test/JsonSpec.js index 2bd7241f..d3f6de0f 100644 --- a/test/JsonSpec.js +++ b/test/JsonSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('json', function(){ +describe('json', function() { it('should serialize primitives', function() { expect(toJson(0/0)).toEqual('null'); expect(toJson(null)).toEqual('null'); @@ -11,11 +11,11 @@ describe('json', function(){ expect(toJson("a \t \n \r b \\")).toEqual('"a \\t \\n \\r b \\\\"'); }); - it('should not serialize $$properties', function(){ + it('should not serialize $$properties', function() { expect(toJson({$$some:'value', 'this':1, '$parent':1}, false)).toEqual('{}'); }); - it('should not serialize this or $parent', function(){ + it('should not serialize this or $parent', function() { expect(toJson({'this':'value', $parent:'abc'}, false)).toEqual('{}'); }); @@ -46,8 +46,8 @@ describe('json', function(){ }); it('should ignore functions', function() { - expect(toJson([function(){},1])).toEqual('[null,1]'); - expect(toJson({a:function(){}})).toEqual('{}'); + expect(toJson([function() {},1])).toEqual('[null,1]'); + expect(toJson({a:function() {}})).toEqual('{}'); }); it('should parse null', function() { @@ -127,7 +127,7 @@ describe('json', function(){ expect(fromJson("{exp:1.2e-10}")).toEqual({exp:1.2E-10}); }); - it('should ignore non-strings', function(){ + it('should ignore non-strings', function() { expect(fromJson([])).toEqual([]); expect(fromJson({})).toEqual({}); expect(fromJson(null)).toEqual(null); @@ -170,51 +170,51 @@ describe('json', function(){ } - describe('security', function(){ - it('should not allow naked expressions', function(){ - expect(function(){fromJson('1+2');}). + describe('security', function() { + it('should not allow naked expressions', function() { + expect(function() {fromJson('1+2');}). toThrow(new Error("Syntax Error: Token '+' is an unexpected token at column 2 of the expression [1+2] starting at [+2].")); }); - it('should not allow naked expressions group', function(){ - expect(function(){fromJson('(1+2)');}). + it('should not allow naked expressions group', function() { + expect(function() {fromJson('(1+2)');}). toThrow(new Error("Syntax Error: Token '(' is not valid json at column 1 of the expression [(1+2)] starting at [(1+2)].")); }); - it('should not allow expressions in objects', function(){ - expect(function(){fromJson('{a:abc()}');}). + it('should not allow expressions in objects', function() { + expect(function() {fromJson('{a:abc()}');}). toThrow(new Error("Syntax Error: Token 'abc' is not valid json at column 4 of the expression [{a:abc()}] starting at [abc()}].")); }); - it('should not allow expressions in arrays', function(){ - expect(function(){fromJson('[1+2]');}). + it('should not allow expressions in arrays', function() { + expect(function() {fromJson('[1+2]');}). toThrow(new Error("Syntax Error: Token '+' is not valid json at column 3 of the expression [[1+2]] starting at [+2]].")); }); - it('should not allow vars', function(){ - expect(function(){fromJson('[1, x]');}). + it('should not allow vars', function() { + expect(function() {fromJson('[1, x]');}). toThrow(new Error("Syntax Error: Token 'x' is not valid json at column 5 of the expression [[1, x]] starting at [x]].")); }); - it('should not allow dereference', function(){ - expect(function(){fromJson('["".constructor]');}). + it('should not allow dereference', function() { + expect(function() {fromJson('["".constructor]');}). toThrow(new Error("Syntax Error: Token '.' is not valid json at column 4 of the expression [[\"\".constructor]] starting at [.constructor]].")); }); - it('should not allow expressions ofter valid json', function(){ - expect(function(){fromJson('[].constructor');}). + it('should not allow expressions ofter valid json', function() { + expect(function() {fromJson('[].constructor');}). toThrow(new Error("Syntax Error: Token '.' is not valid json at column 3 of the expression [[].constructor] starting at [.constructor].")); }); - it('should not allow object dereference', function(){ - expect(function(){fromJson('{a:1, b: $location, c:1}');}).toThrow(); - expect(function(){fromJson("{a:1, b:[1]['__parent__']['location'], c:1}");}).toThrow(); + it('should not allow object dereference', function() { + expect(function() {fromJson('{a:1, b: $location, c:1}');}).toThrow(); + expect(function() {fromJson("{a:1, b:[1]['__parent__']['location'], c:1}");}).toThrow(); }); - it('should not allow assignments', function(){ - expect(function(){fromJson("{a:1, b:[1]=1, c:1}");}).toThrow(); - expect(function(){fromJson("{a:1, b:=1, c:1}");}).toThrow(); - expect(function(){fromJson("{a:1, b:x=1, c:1}");}).toThrow(); + it('should not allow assignments', function() { + expect(function() {fromJson("{a:1, b:[1]=1, c:1}");}).toThrow(); + expect(function() {fromJson("{a:1, b:=1, c:1}");}).toThrow(); + expect(function() {fromJson("{a:1, b:x=1, c:1}");}).toThrow(); }); }); diff --git a/test/ParserSpec.js b/test/ParserSpec.js index 980a673c..975cacc4 100644 --- a/test/ParserSpec.js +++ b/test/ParserSpec.js @@ -191,7 +191,7 @@ describe('parser', function() { expect(scope.$eval("'a' + 'b c'")).toEqual("ab c"); }); - it('should parse filters', function(){ + it('should parse filters', function() { angular.filter.substring = function(input, start, end) { return input.substring(start, end); }; @@ -416,8 +416,8 @@ describe('parser', function() { }); - describe('assignable', function(){ - it('should expose assignment function', function(){ + describe('assignable', function() { + it('should expose assignment function', function() { var fn = parser('a').assignable(); expect(fn.assign).toBeTruthy(); var scope = {}; diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js index b6c116f7..15bbbdae 100644 --- a/test/ResourceSpec.js +++ b/test/ResourceSpec.js @@ -16,7 +16,7 @@ describe("resource", function() { callback = jasmine.createSpy(); }); - it("should build resource", function(){ + it("should build resource", function() { expect(typeof CreditCard).toBe('function'); expect(typeof CreditCard.get).toBe('function'); expect(typeof CreditCard.save).toBe('function'); @@ -25,12 +25,12 @@ describe("resource", function() { expect(typeof CreditCard.query).toBe('function'); }); - it('should default to empty parameters', function(){ + it('should default to empty parameters', function() { xhr.expectGET('URL').respond({}); resource.route('URL').query(); }); - it('should ignore slashes of undefinend parameters', function(){ + it('should ignore slashes of undefinend parameters', function() { var R = resource.route('/Path/:a/:b/:c'); xhr.expectGET('/Path').respond({}); xhr.expectGET('/Path/1').respond({}); @@ -42,7 +42,7 @@ describe("resource", function() { R.get({a:4, b:5, c:6}); }); - it('should correctly encode url params', function(){ + it('should correctly encode url params', function() { var R = resource.route('/Path/:a'); xhr.expectGET('/Path/foo%231').respond({}); xhr.expectGET('/Path/doh!@foo?bar=baz%231').respond({}); @@ -67,7 +67,7 @@ describe("resource", function() { R.get({a: 'doh&foo', bar: 'baz&1'}); }); - it("should build resource with default param", function(){ + it("should build resource with default param", function() { xhr.expectGET('/Order/123/Line/456.visa?minimum=0.05').respond({id:'abc'}); var LineItem = resource.route('/Order/:orderId/Line/:id:verb', {orderId: '123', id: '@id.key', verb:'.visa', minimum:0.05}); var item = LineItem.get({id:456}); @@ -75,7 +75,7 @@ describe("resource", function() { nakedExpect(item).toEqual({id:'abc'}); }); - it("should build resource with action default param overriding default param", function(){ + it("should build resource with action default param overriding default param", function() { xhr.expectGET('/Customer/123').respond({id:'abc'}); var TypeItem = resource.route('/:type/:typeId', {type: 'Order'}, {get: {method: 'GET', params: {type: 'Customer'}}}); @@ -84,7 +84,7 @@ describe("resource", function() { nakedExpect(item).toEqual({id:'abc'}); }); - it("should create resource", function(){ + it("should create resource", function() { xhr.expectPOST('/CreditCard', {name:'misko'}).respond({id:123, name:'misko'}); var cc = CreditCard.save({name:'misko'}, callback); @@ -95,7 +95,7 @@ describe("resource", function() { expect(callback).toHaveBeenCalledWith(cc); }); - it("should read resource", function(){ + it("should read resource", function() { xhr.expectGET("/CreditCard/123").respond({id:123, number:'9876'}); var cc = CreditCard.get({id:123}, callback); expect(cc instanceof CreditCard).toBeTruthy(); @@ -106,7 +106,7 @@ describe("resource", function() { expect(callback).toHaveBeenCalledWith(cc); }); - it("should read partial resource", function(){ + it("should read partial resource", function() { xhr.expectGET("/CreditCard").respond([{id:{key:123}}]); xhr.expectGET("/CreditCard/123").respond({id:{key:123}, number:'9876'}); var ccs = CreditCard.query(); @@ -121,7 +121,7 @@ describe("resource", function() { expect(cc.number).toEqual('9876'); }); - it("should update resource", function(){ + it("should update resource", function() { xhr.expectPOST('/CreditCard/123', {id:{key:123}, name:'misko'}).respond({id:{key:123}, name:'rama'}); var cc = CreditCard.save({id:{key:123}, name:'misko'}, callback); @@ -130,7 +130,7 @@ describe("resource", function() { xhr.flush(); }); - it("should query resource", function(){ + it("should query resource", function() { xhr.expectGET("/CreditCard?key=value").respond([{id:1}, {id:2}]); var ccs = CreditCard.query({key:'value'}, callback); @@ -141,16 +141,16 @@ describe("resource", function() { expect(callback).toHaveBeenCalledWith(ccs); }); - it("should have all arguments optional", function(){ + it("should have all arguments optional", function() { xhr.expectGET('/CreditCard').respond([{id:1}]); var log = ''; - var ccs = CreditCard.query(function(){ log += 'cb;'; }); + var ccs = CreditCard.query(function() { log += 'cb;'; }); xhr.flush(); nakedExpect(ccs).toEqual([{id:1}]); expect(log).toEqual('cb;'); }); - it('should delete resource and call callback', function(){ + it('should delete resource and call callback', function() { xhr.expectDELETE("/CreditCard/123").respond(200, {}); CreditCard.remove({id:123}, callback); @@ -166,20 +166,20 @@ describe("resource", function() { nakedExpect(callback.mostRecentCall.args).toEqual([{}]); }); - it('should post charge verb', function(){ + it('should post charge verb', function() { xhr.expectPOST('/CreditCard/123!charge?amount=10', {auth:'abc'}).respond({success:'ok'}); CreditCard.charge({id:123, amount:10},{auth:'abc'}, callback); }); - it('should post charge verb on instance', function(){ + it('should post charge verb on instance', function() { xhr.expectPOST('/CreditCard/123!charge?amount=10', {id:{key:123}, name:'misko'}).respond({success:'ok'}); var card = new CreditCard({id:{key:123}, name:'misko'}); card.$charge({amount:10}, callback); }); - it('should create on save', function(){ + it('should create on save', function() { xhr.expectPOST('/CreditCard', {name:'misko'}).respond({id:123}); var cc = new CreditCard(); expect(cc.$get).toBeDefined(); @@ -195,7 +195,7 @@ describe("resource", function() { expect(callback).toHaveBeenCalledWith(cc); }); - it('should not mutate the resource object if response contains no body', function(){ + it('should not mutate the resource object if response contains no body', function() { var data = {id:{key:123}, number:'9876'}; xhr.expectGET("/CreditCard/123").respond(data); var cc = CreditCard.get({id:123}); @@ -209,7 +209,7 @@ describe("resource", function() { expect(idBefore).toEqual(cc.id); }); - it('should bind default parameters', function(){ + it('should bind default parameters', function() { xhr.expectGET('/CreditCard/123.visa?minimum=0.05').respond({id:123}); var Visa = CreditCard.bind({verb:'.visa', minimum:0.05}); var visa = Visa.get({id:123}); @@ -217,7 +217,7 @@ describe("resource", function() { nakedExpect(visa).toEqual({id:123}); }); - it('should excersize full stack', function(){ + it('should excersize full stack', function() { var scope = angular.compile('<div></div>')(); var $browser = scope.$service('$browser'); var $resource = scope.$service('$resource'); @@ -229,7 +229,7 @@ describe("resource", function() { dealoc(scope); }); - it('should return the same object when verifying the cache', function(){ + it('should return the same object when verifying the cache', function() { var scope = angular.compile('<div></div>')(); var $browser = scope.$service('$browser'); var $resource = scope.$service('$resource'); diff --git a/test/ScenarioSpec.js b/test/ScenarioSpec.js index 52cfd454..5f83ab93 100644 --- a/test/ScenarioSpec.js +++ b/test/ScenarioSpec.js @@ -1,18 +1,18 @@ 'use strict'; -describe("ScenarioSpec: Compilation", function(){ +describe("ScenarioSpec: Compilation", function() { var scope; - beforeEach(function(){ + beforeEach(function() { scope = null; }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - describe('compilation', function(){ - it("should compile dom node and return scope", function(){ + describe('compilation', function() { + it("should compile dom node and return scope", function() { var node = jqLite('<div ng:init="a=1">{{b=a+1}}</div>')[0]; scope = angular.compile(node)(); scope.$digest(); @@ -20,13 +20,13 @@ describe("ScenarioSpec: Compilation", function(){ expect(scope.b).toEqual(2); }); - it("should compile jQuery node and return scope", function(){ + it("should compile jQuery node and return scope", function() { scope = compile(jqLite('<div>{{a=123}}</div>'))(); scope.$digest(); expect(jqLite(scope.$element).text()).toEqual('123'); }); - it("should compile text node and return scope", function(){ + it("should compile text node and return scope", function() { scope = angular.compile('<div>{{a=123}}</div>')(); scope.$digest(); expect(jqLite(scope.$element).text()).toEqual('123'); diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index fa41e5a9..b1942646 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('Scope', function(){ +describe('Scope', function() { var root = null, mockHandler = null; beforeEach(function() { @@ -302,7 +302,7 @@ describe('Scope', function(){ }); - describe('$destroy', function(){ + describe('$destroy', function() { var first = null, middle = null, last = null, log = null; beforeEach(function() { @@ -471,7 +471,7 @@ describe('Scope', function(){ root = angular.scope(), child = root.$new(); - function eventFn(){ + function eventFn() { log += 'X'; } @@ -492,7 +492,7 @@ describe('Scope', function(){ child = root.$new(), listenerRemove; - function eventFn(){ + function eventFn() { log += 'X'; } diff --git a/test/angular-mocksSpec.js b/test/angular-mocksSpec.js index bf5c7816..c2cffca6 100644 --- a/test/angular-mocksSpec.js +++ b/test/angular-mocksSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('mocks', function(){ +describe('mocks', function() { describe('TzDate', function() { function minutes(min) { @@ -172,26 +172,26 @@ describe('mocks', function(){ }); }); - describe('defer', function(){ + describe('defer', function() { var browser, log; - beforeEach(function(){ + beforeEach(function() { browser = new MockBrowser(); log = ''; }); - function logFn(text){ return function(){ + function logFn(text){ return function() { log += text +';'; }; } - it('should flush', function(){ + it('should flush', function() { browser.defer(logFn('A')); expect(log).toEqual(''); browser.defer.flush(); expect(log).toEqual('A;'); }); - it('should flush delayed', function(){ + it('should flush delayed', function() { browser.defer(logFn('A')); browser.defer(logFn('B'), 10); browser.defer(logFn('C'), 20); @@ -205,7 +205,7 @@ describe('mocks', function(){ expect(log).toEqual('A;B;C;'); }); - it('should defer and flush over time', function(){ + it('should defer and flush over time', function() { browser.defer(logFn('A'), 1); browser.defer(logFn('B'), 2); browser.defer(logFn('C'), 3); diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 1cbb92b0..8c07cf70 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -63,8 +63,8 @@ describe("directive", function() { expect(lowercase(element.html())).toEqual('<a>hello</a>'); }); - it('should have $element set to current bind element', function(){ - angularFilter.myFilter = function(){ + it('should have $element set to current bind element', function() { + angularFilter.myFilter = function() { this.$element.addClass("filter"); return 'HELLO'; }; @@ -80,7 +80,7 @@ describe("directive", function() { expect(scope.$element.text()).toEqual('-0false'); }); - it('should render object as JSON ignore $$', function(){ + it('should render object as JSON ignore $$', function() { var scope = compile('<div>{{ {key:"value", $$key:"hide"} }}</div>'); scope.$digest(); expect(fromJson(scope.$element.text())).toEqual({key:'value'}); @@ -108,7 +108,7 @@ describe("directive", function() { expect(innerText).toEqual('INNER'); }); - it('should render object as JSON ignore $$', function(){ + it('should render object as JSON ignore $$', function() { var scope = compile('<pre>{{ {key:"value", $$key:"hide"} }}</pre>'); scope.$digest(); expect(fromJson(scope.$element.text())).toEqual({key:'value'}); @@ -148,7 +148,7 @@ describe("directive", function() { expect(input.checked).toEqual(true); }); - describe('ng:click', function(){ + describe('ng:click', function() { it('should get called on a click', function() { var scope = compile('<div ng:click="clicked = true"></div>'); scope.$digest(); @@ -208,7 +208,7 @@ describe("directive", function() { }); - it('should support adding multiple classes via an array', function(){ + it('should support adding multiple classes via an array', function() { var scope = compile('<div class="existing" ng:class="[\'A\', \'B\']"></div>'); scope.$digest(); expect(element.hasClass('existing')).toBeTruthy(); @@ -217,7 +217,7 @@ describe("directive", function() { }); - it('should support adding multiple classes via a space delimited string', function(){ + it('should support adding multiple classes via a space delimited string', function() { var scope = compile('<div class="existing" ng:class="\'A B\'"></div>'); scope.$digest(); expect(element.hasClass('existing')).toBeTruthy(); @@ -420,7 +420,7 @@ describe("directive", function() { }); describe('ng:hide', function() { - it('should hide an element', function(){ + it('should hide an element', function() { var element = jqLite('<div ng:hide="exp"></div>'), scope = compile(element); @@ -480,7 +480,7 @@ describe("directive", function() { expect(scope.$element.text()).toEqual('hey dude!'); }); - it('should infer injection arguments', function(){ + it('should infer injection arguments', function() { temp.MyController = function($xhr){ this.$root.someService = $xhr; }; diff --git a/test/jQueryPatchSpec.js b/test/jQueryPatchSpec.js index 0953bdac..19f4d821 100644 --- a/test/jQueryPatchSpec.js +++ b/test/jQueryPatchSpec.js @@ -2,14 +2,14 @@ if (window.jQuery) { - describe('jQuery patch', function(){ + describe('jQuery patch', function() { var doc = null; var divSpy = null; var spy1 = null; var spy2 = null; - beforeEach(function(){ + beforeEach(function() { divSpy = jasmine.createSpy('div.$destroy'); spy1 = jasmine.createSpy('span1.$destroy'); spy2 = jasmine.createSpy('span2.$destroy'); @@ -18,7 +18,7 @@ if (window.jQuery) { doc.find('span.second').bind('$destroy', spy2); }); - afterEach(function(){ + afterEach(function() { expect(divSpy).not.toHaveBeenCalled(); expect(spy1).toHaveBeenCalled(); @@ -27,29 +27,29 @@ if (window.jQuery) { expect(spy2.callCount).toEqual(1); }); - describe('$detach event', function(){ + describe('$detach event', function() { - it('should fire on detach()', function(){ + it('should fire on detach()', function() { doc.find('span').detach(); }); - it('should fire on remove()', function(){ + it('should fire on remove()', function() { doc.find('span').remove(); }); - it('should fire on replaceWith()', function(){ + it('should fire on replaceWith()', function() { doc.find('span').replaceWith('<b>bla</b>'); }); - it('should fire on replaceAll()', function(){ + it('should fire on replaceAll()', function() { $('<b>bla</b>').replaceAll(doc.find('span')); }); - it('should fire on empty()', function(){ + it('should fire on empty()', function() { doc.empty(); }); - it('should fire on html()', function(){ + it('should fire on html()', function() { doc.html('abc'); }); }); diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 28cc7b90..96712210 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -1,16 +1,16 @@ 'use strict'; -describe('jqLite', function(){ +describe('jqLite', function() { var scope, a, b, c; - beforeEach(function(){ + beforeEach(function() { a = jqLite('<div>A</div>')[0]; b = jqLite('<div>B</div>')[0]; c = jqLite('<div>C</div>')[0]; }); - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(); this.addMatchers({ toJqEqual: function(expected) { @@ -32,7 +32,7 @@ describe('jqLite', function(){ }); - afterEach(function(){ + afterEach(function() { dealoc(a); dealoc(b); dealoc(c); @@ -44,8 +44,8 @@ describe('jqLite', function(){ }); - describe('construction', function(){ - it('should allow construction with text node', function(){ + describe('construction', function() { + it('should allow construction with text node', function() { var text = a.firstChild; var selected = jqLite(text); expect(selected.length).toEqual(1); @@ -53,7 +53,7 @@ describe('jqLite', function(){ }); - it('should allow construction with html', function(){ + it('should allow construction with html', function() { var nodes = jqLite('<div>1</div><span>2</span>'); expect(nodes.length).toEqual(2); expect(nodes[0].innerHTML).toEqual('1'); @@ -138,8 +138,8 @@ describe('jqLite', function(){ }); - describe('data', function(){ - it('should set and get and remove data', function(){ + describe('data', function() { + it('should set and get and remove data', function() { var selected = jqLite([a, b, c]); expect(selected.data('prop', 'value')).toEqual(selected); @@ -160,18 +160,18 @@ describe('jqLite', function(){ expect(jqLite(c).data('prop')).toEqual(undefined); }); - it('should call $destroy function if element removed', function(){ + it('should call $destroy function if element removed', function() { var log = ''; var element = jqLite(a); - element.bind('$destroy', function(){log+= 'destroy;';}); + element.bind('$destroy', function() {log+= 'destroy;';}); element.remove(); expect(log).toEqual('destroy;'); }); }); - describe('attr', function(){ - it('shoul read write and remove attr', function(){ + describe('attr', function() { + it('shoul read write and remove attr', function() { var selector = jqLite([a, b]); expect(selector.attr('prop', 'value')).toEqual(selector); @@ -191,7 +191,7 @@ describe('jqLite', function(){ expect(jqLite(b).attr('prop')).toBeFalsy(); }); - it('should read special attributes as strings', function(){ + it('should read special attributes as strings', function() { var select = jqLite('<select>'); expect(select.attr('multiple')).toBeUndefined(); expect(jqLite('<select multiple>').attr('multiple')).toBe('multiple'); @@ -244,16 +244,16 @@ describe('jqLite', function(){ }); - describe('class', function(){ + describe('class', function() { - describe('hasClass', function(){ - it('should check class', function(){ + describe('hasClass', function() { + it('should check class', function() { var selector = jqLite([a, b]); expect(selector.hasClass('abc')).toEqual(false); }); - it('should make sure that partial class is not checked as a subset', function(){ + it('should make sure that partial class is not checked as a subset', function() { var selector = jqLite([a, b]); selector.addClass('a'); selector.addClass('b'); @@ -316,8 +316,8 @@ describe('jqLite', function(){ }); - describe('toggleClass', function(){ - it('should allow toggling of class', function(){ + describe('toggleClass', function() { + it('should allow toggling of class', function() { var selector = jqLite([a, b]); expect(selector.toggleClass('abc')).toEqual(selector); expect(jqLite(a).hasClass('abc')).toEqual(true); @@ -339,8 +339,8 @@ describe('jqLite', function(){ }); - describe('removeClass', function(){ - it('should allow removal of class', function(){ + describe('removeClass', function() { + it('should allow removal of class', function() { var selector = jqLite([a, b]); expect(selector.addClass('abc')).toEqual(selector); expect(selector.removeClass('abc')).toEqual(selector); @@ -372,8 +372,8 @@ describe('jqLite', function(){ }); - describe('css', function(){ - it('should set and read css', function(){ + describe('css', function() { + it('should set and read css', function() { var selector = jqLite([a, b]); expect(selector.css('margin', '1px')).toEqual(selector); @@ -439,14 +439,14 @@ describe('jqLite', function(){ }); - describe('text', function(){ - it('should return null on empty', function(){ + describe('text', function() { + it('should return null on empty', function() { expect(jqLite().length).toEqual(0); expect(jqLite().text()).toEqual(''); }); - it('should read/write value', function(){ + it('should read/write value', function() { var element = jqLite('<div>abc</div>'); expect(element.length).toEqual(1); expect(element[0].innerHTML).toEqual('abc'); @@ -457,8 +457,8 @@ describe('jqLite', function(){ }); - describe('val', function(){ - it('should read, write value', function(){ + describe('val', function() { + it('should read, write value', function() { var input = jqLite('<input type="text"/>'); expect(input.val('abc')).toEqual(input); expect(input[0].value).toEqual('abc'); @@ -467,14 +467,14 @@ describe('jqLite', function(){ }); - describe('html', function(){ - it('should return null on empty', function(){ + describe('html', function() { + it('should return null on empty', function() { expect(jqLite().length).toEqual(0); expect(jqLite().html()).toEqual(null); }); - it('should read/write value', function(){ + it('should read/write value', function() { var element = jqLite('<div>abc</div>'); expect(element.length).toEqual(1); expect(element[0].innerHTML).toEqual('abc'); @@ -485,8 +485,8 @@ describe('jqLite', function(){ }); - describe('bind', function(){ - it('should bind to window on hashchange', function(){ + describe('bind', function() { + it('should bind to window on hashchange', function() { if (jqLite.fn) return; // don't run in jQuery var eventFn; var window = { @@ -507,7 +507,7 @@ describe('jqLite', function(){ detachEvent: noop }; var log; - var jWindow = jqLite(window).bind('hashchange', function(){ + var jWindow = jqLite(window).bind('hashchange', function() { log = 'works!'; }); eventFn({}); @@ -516,10 +516,10 @@ describe('jqLite', function(){ }); - it('should bind to all elements and return functions', function(){ + it('should bind to all elements and return functions', function() { var selected = jqLite([a, b]); var log = ''; - expect(selected.bind('click', function(){ + expect(selected.bind('click', function() { log += 'click on: ' + jqLite(this).text() + ';'; })).toEqual(selected); browserTrigger(a, 'click'); @@ -664,8 +664,8 @@ describe('jqLite', function(){ }); - describe('replaceWith', function(){ - it('should replaceWith', function(){ + describe('replaceWith', function() { + it('should replaceWith', function() { var root = jqLite('<div>').html('before-<div></div>after'); var div = root.find('div'); expect(div.replaceWith('<span>span-</span><b>bold-</b>')).toEqual(div); @@ -673,7 +673,7 @@ describe('jqLite', function(){ }); - it('should replaceWith text', function(){ + it('should replaceWith text', function() { var root = jqLite('<div>').html('before-<div></div>after'); var div = root.find('div'); expect(div.replaceWith('text-')).toEqual(div); @@ -682,8 +682,8 @@ describe('jqLite', function(){ }); - describe('children', function(){ - it('should select non-text children', function(){ + describe('children', function() { + it('should select non-text children', function() { var root = jqLite('<div>').html('before-<div></div>after-<span></span>'); var div = root.find('div'); var span = root.find('span'); @@ -692,13 +692,13 @@ describe('jqLite', function(){ }); - describe('append', function(){ - it('should append', function(){ + describe('append', function() { + it('should append', function() { var root = jqLite('<div>'); expect(root.append('<span>abc</span>')).toEqual(root); expect(root.html().toLowerCase()).toEqual('<span>abc</span>'); }); - it('should append text', function(){ + it('should append text', function() { var root = jqLite('<div>'); expect(root.append('text')).toEqual(root); expect(root.html()).toEqual('text'); @@ -710,18 +710,18 @@ describe('jqLite', function(){ }); }); - describe('prepend', function(){ - it('should prepend to empty', function(){ + describe('prepend', function() { + it('should prepend to empty', function() { var root = jqLite('<div>'); expect(root.prepend('<span>abc</span>')).toEqual(root); expect(root.html().toLowerCase()).toEqual('<span>abc</span>'); }); - it('should prepend to content', function(){ + it('should prepend to content', function() { var root = jqLite('<div>text</div>'); expect(root.prepend('<span>abc</span>')).toEqual(root); expect(root.html().toLowerCase()).toEqual('<span>abc</span>text'); }); - it('should prepend text to content', function(){ + it('should prepend text to content', function() { var root = jqLite('<div>text</div>'); expect(root.prepend('abc')).toEqual(root); expect(root.html().toLowerCase()).toEqual('abctext'); @@ -729,8 +729,8 @@ describe('jqLite', function(){ }); - describe('remove', function(){ - it('should remove', function(){ + describe('remove', function() { + it('should remove', function() { var root = jqLite('<div><span>abc</span></div>'); var span = root.find('span'); expect(span.remove()).toEqual(span); @@ -739,8 +739,8 @@ describe('jqLite', function(){ }); - describe('after', function(){ - it('should after', function(){ + describe('after', function() { + it('should after', function() { var root = jqLite('<div><span></span></div>'); var span = root.find('span'); expect(span.after('<i></i><b></b>')).toEqual(span); @@ -748,7 +748,7 @@ describe('jqLite', function(){ }); - it('should allow taking text', function(){ + it('should allow taking text', function() { var root = jqLite('<div><span></span></div>'); var span = root.find('span'); span.after('abc'); @@ -757,8 +757,8 @@ describe('jqLite', function(){ }); - describe('parent', function(){ - it('should return parent or an empty set when no parent', function(){ + describe('parent', function() { + it('should return parent or an empty set when no parent', function() { var parent = jqLite('<div><p>abc</p></div>'), child = parent.find('p'); @@ -790,7 +790,7 @@ describe('jqLite', function(){ describe('next', function() { - it('should return next sibling', function(){ + it('should return next sibling', function() { var element = jqLite('<div><b>b</b><i>i</i></div>'); var b = element.find('b'); var i = element.find('i'); @@ -800,7 +800,7 @@ describe('jqLite', function(){ describe('find', function() { - it('should find child by name', function(){ + it('should find child by name', function() { var root = jqLite('<div><div>text</div></div>'); var innerDiv = root.find('div'); expect(innerDiv.length).toEqual(1); diff --git a/test/jstd-scenario-adapter/AdapterSpecs.js b/test/jstd-scenario-adapter/AdapterSpecs.js index f0d54d3c..e360ad4f 100644 --- a/test/jstd-scenario-adapter/AdapterSpecs.js +++ b/test/jstd-scenario-adapter/AdapterSpecs.js @@ -42,7 +42,7 @@ describe('jstd-adapter', function() { */ function buildTestConf(type) { return new jstestdriver.TestRunConfiguration( - new jstestdriver.TestCaseInfo('Fake test - ' + Math.random(), function(){}, type), null); + new jstestdriver.TestCaseInfo('Fake test - ' + Math.random(), function() {}, type), null); } /** diff --git a/test/manual.html b/test/manual.html index ef2fff3a..8aa64128 100644 --- a/test/manual.html +++ b/test/manual.html @@ -52,7 +52,7 @@ <!-- include spec files here... --> <script type="text/javascript"> -describe('manual', function(){ +describe('manual', function() { var compile, model, element; beforeEach(function() { @@ -120,7 +120,7 @@ describe('angular.scenario.output.json', function() { <script type="text/javascript"> jasmine.getEnv().addReporter(new jasmine.TrivialReporter()); - function run(){ + function run() { jasmine.getEnv().execute(); } run(); diff --git a/test/markupSpec.js b/test/markupSpec.js index bd77c058..d505ee73 100644 --- a/test/markupSpec.js +++ b/test/markupSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe("markups", function(){ +describe("markups", function() { var compile, element, scope; @@ -13,11 +13,11 @@ describe("markups", function(){ }; }); - afterEach(function(){ + afterEach(function() { dealoc(element); }); - it('should translate {{}} in text', function(){ + it('should translate {{}} in text', function() { compile('<div>hello {{name}}!</div>'); expect(sortedHtml(element)).toEqual('<div>hello <span ng:bind="name"></span>!</div>'); scope.name = 'Misko'; @@ -25,7 +25,7 @@ describe("markups", function(){ expect(sortedHtml(element)).toEqual('<div>hello <span ng:bind="name">Misko</span>!</div>'); }); - it('should translate {{}} in terminal nodes', function(){ + it('should translate {{}} in terminal nodes', function() { compile('<select ng:model="x"><option value="">Greet {{name}}!</option></select>'); scope.$digest(); expect(sortedHtml(element).replace(' selected="true"', '')). @@ -40,7 +40,7 @@ describe("markups", function(){ '</select>'); }); - it('should translate {{}} in attributes', function(){ + it('should translate {{}} in attributes', function() { compile('<div src="http://server/{{path}}.png"/>'); expect(element.attr('ng:bind-attr')).toEqual('{"src":"http://server/{{path}}.png"}'); scope.path = 'a/b'; @@ -48,11 +48,11 @@ describe("markups", function(){ expect(element.attr('src')).toEqual("http://server/a/b.png"); }); - describe('OPTION value', function(){ - beforeEach(function(){ + describe('OPTION value', function() { + beforeEach(function() { this.addMatchers({ toHaveValue: function(expected){ - this.message = function(){ + this.message = function() { return 'Expected "' + this.actual.html() + '" to have value="' + expected + '".'; }; @@ -74,22 +74,22 @@ describe("markups", function(){ }); - it('should populate value attribute on OPTION', function(){ + it('should populate value attribute on OPTION', function() { compile('<select ng:model="x"><option>abc</option></select>'); expect(element).toHaveValue('abc'); }); - it('should ignore value if already exists', function(){ + it('should ignore value if already exists', function() { compile('<select ng:model="x"><option value="abc">xyz</option></select>'); expect(element).toHaveValue('abc'); }); - it('should set value even if newlines present', function(){ + it('should set value even if newlines present', function() { compile('<select ng:model="x"><option attr="\ntext\n" \n>\nabc\n</option></select>'); expect(element).toHaveValue('\nabc\n'); }); - it('should set value even if self closing HTML', function(){ + it('should set value even if self closing HTML', function() { // IE removes the \n from option, which makes this test pointless if (msie) return; compile('<select ng:model="x"><option>\n</option></select>'); @@ -174,21 +174,21 @@ describe("markups", function(){ }); }); - it('should Parse Text With No Bindings', function(){ + it('should Parse Text With No Bindings', function() { var parts = parseBindings("a"); assertEquals(parts.length, 1); assertEquals(parts[0], "a"); assertTrue(!binding(parts[0])); }); - it('should Parse Empty Text', function(){ + it('should Parse Empty Text', function() { var parts = parseBindings(""); assertEquals(parts.length, 1); assertEquals(parts[0], ""); assertTrue(!binding(parts[0])); }); - it('should Parse Inner Binding', function(){ + it('should Parse Inner Binding', function() { var parts = parseBindings("a{{b}}C"); assertEquals(parts.length, 3); assertEquals(parts[0], "a"); @@ -199,7 +199,7 @@ describe("markups", function(){ assertTrue(!binding(parts[2])); }); - it('should Parse Ending Binding', function(){ + it('should Parse Ending Binding', function() { var parts = parseBindings("a{{b}}"); assertEquals(parts.length, 2); assertEquals(parts[0], "a"); @@ -208,7 +208,7 @@ describe("markups", function(){ assertEquals(binding(parts[1]), "b"); }); - it('should Parse Begging Binding', function(){ + it('should Parse Begging Binding', function() { var parts = parseBindings("{{b}}c"); assertEquals(parts.length, 2); assertEquals(parts[0], "{{b}}"); @@ -217,14 +217,14 @@ describe("markups", function(){ assertTrue(!binding(parts[1])); }); - it('should Parse Loan Binding', function(){ + it('should Parse Loan Binding', function() { var parts = parseBindings("{{b}}"); assertEquals(parts.length, 1); assertEquals(parts[0], "{{b}}"); assertEquals(binding(parts[0]), "b"); }); - it('should Parse Two Bindings', function(){ + it('should Parse Two Bindings', function() { var parts = parseBindings("{{b}}{{c}}"); assertEquals(parts.length, 2); assertEquals(parts[0], "{{b}}"); @@ -233,7 +233,7 @@ describe("markups", function(){ assertEquals(binding(parts[1]), "c"); }); - it('should Parse Two Bindings With Text In Middle', function(){ + it('should Parse Two Bindings With Text In Middle', function() { var parts = parseBindings("{{b}}x{{c}}"); assertEquals(parts.length, 3); assertEquals(parts[0], "{{b}}"); @@ -244,7 +244,7 @@ describe("markups", function(){ assertEquals(binding(parts[2]), "c"); }); - it('should Parse Multiline', function(){ + it('should Parse Multiline', function() { var parts = parseBindings('"X\nY{{A\nB}}C\nD"'); assertTrue(!!binding('{{A\nB}}')); assertEquals(parts.length, 3); @@ -253,7 +253,7 @@ describe("markups", function(){ assertEquals(parts[2], 'C\nD"'); }); - it('should Has Binding', function(){ + it('should Has Binding', function() { assertTrue(hasBindings(parseBindings("{{a}}"))); assertTrue(!hasBindings(parseBindings("a"))); assertTrue(hasBindings(parseBindings("{{b}}x{{c}}"))); diff --git a/test/mocks.js b/test/mocks.js index 37e1d31b..da0449ac 100644 --- a/test/mocks.js +++ b/test/mocks.js @@ -30,10 +30,10 @@ * See {@link angular.mock} for more info on angular mocks. */ var $logMock = { - log: function(){ $logMock.log.logs.push(concat([], arguments, 0)); }, - warn: function(){ $logMock.warn.logs.push(concat([], arguments, 0)); }, - info: function(){ $logMock.info.logs.push(concat([], arguments, 0)); }, - error: function(){ $logMock.error.logs.push(concat([], arguments, 0)); } + log: function() { $logMock.log.logs.push(concat([], arguments, 0)); }, + warn: function() { $logMock.warn.logs.push(concat([], arguments, 0)); }, + info: function() { $logMock.info.logs.push(concat([], arguments, 0)); }, + error: function() { $logMock.error.logs.push(concat([], arguments, 0)); } }; $logMock.log.logs = []; $logMock.warn.logs = []; diff --git a/test/sanitizerSpec.js b/test/sanitizerSpec.js index f5ac69ff..7467a833 100644 --- a/test/sanitizerSpec.js +++ b/test/sanitizerSpec.js @@ -1,14 +1,14 @@ 'use strict'; -describe('HTML', function(){ +describe('HTML', function() { function expectHTML(html) { return expect(new HTML(html).get()); } - describe('htmlParser', function(){ + describe('htmlParser', function() { var handler, start, text; - beforeEach(function(){ + beforeEach(function() { handler = { start: function(tag, attrs, unary){ start = { @@ -31,31 +31,31 @@ describe('HTML', function(){ }; }); - it('should parse basic format', function(){ + it('should parse basic format', function() { htmlParser('<tag attr="value">text</tag>', handler); expect(start).toEqual({tag:'tag', attrs:{attr:'value'}, unary:false}); expect(text).toEqual('text'); }); - it('should parse newlines in tags', function(){ + it('should parse newlines in tags', function() { htmlParser('<\ntag\n attr="value"\n>text<\n/\ntag\n>', handler); expect(start).toEqual({tag:'tag', attrs:{attr:'value'}, unary:false}); expect(text).toEqual('text'); }); - it('should parse newlines in attributes', function(){ + it('should parse newlines in attributes', function() { htmlParser('<tag attr="\nvalue\n">text</tag>', handler); expect(start).toEqual({tag:'tag', attrs:{attr:'value'}, unary:false}); expect(text).toEqual('text'); }); - it('should parse namespace', function(){ + it('should parse namespace', function() { htmlParser('<ns:t-a-g ns:a-t-t-r="\nvalue\n">text</ns:t-a-g>', handler); expect(start).toEqual({tag:'ns:t-a-g', attrs:{'ns:a-t-t-r':'value'}, unary:false}); expect(text).toEqual('text'); }); - it('should parse empty value attribute of node', function(){ + it('should parse empty value attribute of node', function() { htmlParser('<OPTION selected value="">abc</OPTION>', handler); expect(start).toEqual({tag:'option', attrs:{selected:'', value:''}, unary:false}); expect(text).toEqual('abc'); @@ -63,87 +63,87 @@ describe('HTML', function(){ }); - it('should echo html', function(){ + it('should echo html', function() { expectHTML('hello<b class="1\'23" align=\'""\'>world</b>.'). toEqual('hello<b class="1\'23" align="""">world</b>.'); }); - it('should remove script', function(){ + it('should remove script', function() { expectHTML('a<SCRIPT>evil< / scrIpt >c.').toEqual('ac.'); }); - it('should remove nested script', function(){ + it('should remove nested script', function() { expectHTML('a< SCRIPT >A< SCRIPT >evil< / scrIpt >B< / scrIpt >c.').toEqual('ac.'); }); - it('should remove attrs', function(){ + it('should remove attrs', function() { expectHTML('a<div style="abc">b</div>c').toEqual('a<div>b</div>c'); }); - it('should remove style', function(){ + it('should remove style', function() { expectHTML('a<STyle>evil</stYle>c.').toEqual('ac.'); }); - it('should remove script and style', function(){ + it('should remove script and style', function() { expectHTML('a<STyle>evil<script></script></stYle>c.').toEqual('ac.'); }); - it('should remove double nested script', function(){ + it('should remove double nested script', function() { expectHTML('a<SCRIPT>ev<script>evil</sCript>il</scrIpt>c.').toEqual('ac.'); }); - it('should remove unknown names', function(){ + it('should remove unknown names', function() { expectHTML('a<xxx><B>b</B></xxx>c').toEqual('a<b>b</b>c'); }); - it('should remove unsafe value', function(){ + it('should remove unsafe value', function() { expectHTML('<a href="javascript:alert()">').toEqual('<a></a>'); }); - it('should handle self closed elements', function(){ + it('should handle self closed elements', function() { expectHTML('a<hr/>c').toEqual('a<hr/>c'); }); - it('should handle namespace', function(){ + it('should handle namespace', function() { expectHTML('a<my:hr/><my:div>b</my:div>c').toEqual('abc'); }); - it('should handle entities', function(){ + it('should handle entities', function() { var everything = '<div rel="!@#$%^&*()_+-={}[]:";\'<>?,./`~ ħ">' + '!@#$%^&*()_+-={}[]:";\'<>?,./`~ ħ</div>'; expectHTML(everything).toEqual(everything); }); - it('should handle improper html', function(){ + it('should handle improper html', function() { expectHTML('< div rel="</div>" alt=abc dir=\'"\' >text< /div>'). toEqual('<div rel="</div>" alt="abc" dir=""">text</div>'); }); - it('should handle improper html2', function(){ + it('should handle improper html2', function() { expectHTML('< div rel="</div>" / >'). toEqual('<div rel="</div>"/>'); }); - it('should ignore back slash as escape', function(){ + it('should ignore back slash as escape', function() { expectHTML('<img alt="xxx\\" title="><script>....">'). toEqual('<img alt="xxx\\" title="><script>...."/>'); }); - it('should ignore object attributes', function(){ + it('should ignore object attributes', function() { expectHTML('<a constructor="hola">:)</a>'). toEqual('<a>:)</a>'); expectHTML('<constructor constructor="hola">:)</constructor>'). toEqual(''); }); - describe('htmlSanitizerWriter', function(){ + describe('htmlSanitizerWriter', function() { var writer, html; - beforeEach(function(){ + beforeEach(function() { html = ''; writer = htmlSanitizeWriter({push:function(text){html+=text;}}); }); - it('should write basic HTML', function(){ + it('should write basic HTML', function() { writer.chars('before'); writer.start('div', {rel:'123'}, false); writer.chars('in'); @@ -153,38 +153,38 @@ describe('HTML', function(){ expect(html).toEqual('before<div rel="123">in</div>after'); }); - it('should escape text nodes', function(){ + it('should escape text nodes', function() { writer.chars('a<div>&</div>c'); expect(html).toEqual('a<div>&</div>c'); }); - it('should escape IE script', function(){ + it('should escape IE script', function() { writer.chars('&<>{}'); expect(html).toEqual('&<>{}'); }); - it('should escape attributes', function(){ + it('should escape attributes', function() { writer.start('div', {rel:'!@#$%^&*()_+-={}[]:";\'<>?,./`~ \n\0\r\u0127'}); expect(html).toEqual('<div rel="!@#$%^&*()_+-={}[]:";\'<>?,./`~ � ħ">'); }); - it('should ignore missformed elements', function(){ + it('should ignore missformed elements', function() { writer.start('d>i&v', {}); expect(html).toEqual(''); }); - it('should ignore unknown attributes', function(){ + it('should ignore unknown attributes', function() { writer.start('div', {unknown:""}); expect(html).toEqual('<div>'); }); - describe('explicitly dissallow', function(){ - it('should not allow attributes', function(){ + describe('explicitly dissallow', function() { + it('should not allow attributes', function() { writer.start('div', {id:'a', name:'a', style:'a'}); expect(html).toEqual('<div>'); }); - it('should not allow tags', function(){ + it('should not allow tags', function() { function tag(name) { writer.start(name, {}); writer.end(name); @@ -209,13 +209,13 @@ describe('HTML', function(){ }); }); - describe('isUri', function(){ + describe('isUri', function() { function isUri(value) { return value.match(URI_REGEXP); } - it('should be URI', function(){ + it('should be URI', function() { expect(isUri('http://abc')).toBeTruthy(); expect(isUri('https://abc')).toBeTruthy(); expect(isUri('ftp://abc')).toBeTruthy(); @@ -223,46 +223,46 @@ describe('HTML', function(){ expect(isUri('#anchor')).toBeTruthy(); }); - it('should not be UIR', function(){ + it('should not be UIR', function() { expect(isUri('')).toBeFalsy(); expect(isUri('javascript:alert')).toBeFalsy(); }); }); - describe('javascript URL attribute', function(){ - beforeEach(function(){ + describe('javascript URL attribute', function() { + beforeEach(function() { this.addMatchers({ - toBeValidUrl: function(){ + toBeValidUrl: function() { return URI_REGEXP.exec(this.actual); } }); }); - it('should ignore javascript:', function(){ + it('should ignore javascript:', function() { expect('JavaScript:abc').not.toBeValidUrl(); expect(' \n Java\n Script:abc').not.toBeValidUrl(); expect('http://JavaScript/my.js').toBeValidUrl(); }); - it('should ignore dec encoded javascript:', function(){ + it('should ignore dec encoded javascript:', function() { expect('javascript:').not.toBeValidUrl(); expect('javascript:').not.toBeValidUrl(); expect('j avascript:').not.toBeValidUrl(); }); - it('should ignore decimal with leading 0 encodede javascript:', function(){ + it('should ignore decimal with leading 0 encodede javascript:', function() { expect('javascript:').not.toBeValidUrl(); expect('j avascript:').not.toBeValidUrl(); expect('j avascript:').not.toBeValidUrl(); }); - it('should ignore hex encoded javascript:', function(){ + it('should ignore hex encoded javascript:', function() { expect('javascript:').not.toBeValidUrl(); expect('javascript:').not.toBeValidUrl(); expect('j avascript:').not.toBeValidUrl(); }); - it('should ignore hex encoded whitespace javascript:', function(){ + it('should ignore hex encoded whitespace javascript:', function() { expect('jav	ascript:alert("A");').not.toBeValidUrl(); expect('jav
ascript:alert("B");').not.toBeValidUrl(); expect('jav
 ascript:alert("C");').not.toBeValidUrl(); diff --git a/test/scenario/DescribeSpec.js b/test/scenario/DescribeSpec.js index 173b0807..6741ed6d 100644 --- a/test/scenario/DescribeSpec.js +++ b/test/scenario/DescribeSpec.js @@ -26,11 +26,11 @@ describe('angular.scenario.Describe', function() { }); it('should handle basic nested case', function() { - root.describe('A', function(){ + root.describe('A', function() { this.beforeEach(log.fn('{')); this.afterEach(log.fn('}')); this.it('1', log.fn('1')); - this.describe('B', function(){ + this.describe('B', function() { this.beforeEach(log.fn('(')); this.afterEach(log.fn(')')); this.it('2', log.fn('2')); diff --git a/test/scenario/dslSpec.js b/test/scenario/dslSpec.js index 3fc69c14..a6e80901 100644 --- a/test/scenario/dslSpec.js +++ b/test/scenario/dslSpec.js @@ -212,7 +212,7 @@ describe("angular.scenario.dsl", function() { expect(_jQuery('[ng\\:model="test"]').val()).toEqual('A'); }); - it('should select option by name', function(){ + it('should select option by name', function() { doc.append( '<select ng:model="test">' + ' <option value=A>one</option>' + diff --git a/test/scenario/e2e/widgets-scenario.js b/test/scenario/e2e/widgets-scenario.js index ca0f8130..fda9b3c6 100644 --- a/test/scenario/e2e/widgets-scenario.js +++ b/test/scenario/e2e/widgets-scenario.js @@ -1,7 +1,7 @@ 'use strict'; describe('widgets', function() { - it('should verify that basic widgets work', function(){ + it('should verify that basic widgets work', function() { browser().navigateTo('widgets.html'); using('#text-basic-box').input('text.basic').enter('Carlos'); diff --git a/test/service/cookieStoreSpec.js b/test/service/cookieStoreSpec.js index fa4f3ceb..0bf7e99d 100644 --- a/test/service/cookieStoreSpec.js +++ b/test/service/cookieStoreSpec.js @@ -9,7 +9,7 @@ describe('$cookieStore', function() { $browser = scope.$service('$browser'); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); diff --git a/test/service/cookiesSpec.js b/test/service/cookiesSpec.js index 782cee72..f078c20c 100644 --- a/test/service/cookiesSpec.js +++ b/test/service/cookiesSpec.js @@ -10,13 +10,13 @@ describe('$cookies', function() { scope.$cookies = scope.$service('$cookies'); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); it('should provide access to existing cookies via object properties and keep them in sync', - function(){ + function() { expect(scope.$cookies).toEqual({'preexisting': 'oldCookie'}); // access internal cookie storage of the browser mock directly to simulate behavior of @@ -55,7 +55,7 @@ describe('$cookies', function() { scope.$cookies.nonString = [1, 2, 3]; scope.$cookies.nullVal = null; scope.$cookies.undefVal = undefined; - scope.$cookies.preexisting = function(){}; + scope.$cookies.preexisting = function() {}; scope.$digest(); expect($browser.cookies()).toEqual({'preexisting': 'oldCookie'}); expect(scope.$cookies).toEqual({'preexisting': 'oldCookie'}); diff --git a/test/service/deferSpec.js b/test/service/deferSpec.js index 4f651522..ad1459ec 100644 --- a/test/service/deferSpec.js +++ b/test/service/deferSpec.js @@ -3,7 +3,7 @@ describe('$defer', function() { var scope, $browser, $defer, $exceptionHandler; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(angular.service, {'$exceptionHandler': jasmine.createSpy('$exceptionHandler')}); $browser = scope.$service('$browser'); @@ -11,7 +11,7 @@ describe('$defer', function() { $exceptionHandler = scope.$service('$exceptionHandler'); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); @@ -69,7 +69,7 @@ describe('$defer', function() { expect(applySpy).toHaveBeenCalled(); }); - it('should allow you to specify the delay time', function(){ + it('should allow you to specify the delay time', function() { var defer = this.spyOn($browser, 'defer'); $defer(noop, 123); expect(defer.callCount).toEqual(1); diff --git a/test/service/documentSpec.js b/test/service/documentSpec.js index 79c752e4..885331e4 100644 --- a/test/service/documentSpec.js +++ b/test/service/documentSpec.js @@ -3,17 +3,17 @@ describe('$document', function() { var scope; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - it("should inject $document", function(){ + it("should inject $document", function() { expect(scope.$service('$document')).toEqual(jqLite(document)); }); }); diff --git a/test/service/exceptionHandlerSpec.js b/test/service/exceptionHandlerSpec.js index 74f37cb9..61e652b5 100644 --- a/test/service/exceptionHandlerSpec.js +++ b/test/service/exceptionHandlerSpec.js @@ -3,17 +3,17 @@ describe('$exceptionHandler', function() { var scope; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - it('should log errors', function(){ + it('should log errors', function() { var scope = createScope({$exceptionHandler: $exceptionHandlerFactory}, {$log: $logMock}), $log = scope.$service('$log'), diff --git a/test/service/formFactorySpec.js b/test/service/formFactorySpec.js index 5223cede..23b8ae0a 100644 --- a/test/service/formFactorySpec.js +++ b/test/service/formFactorySpec.js @@ -1,23 +1,23 @@ 'use strict'; -describe('$formFactory', function(){ +describe('$formFactory', function() { var rootScope; var formFactory; - beforeEach(function(){ + beforeEach(function() { rootScope = angular.scope(); formFactory = rootScope.$service('$formFactory'); }); - it('should have global form', function(){ + it('should have global form', function() { expect(formFactory.rootForm).toBeTruthy(); expect(formFactory.rootForm.$createWidget).toBeTruthy(); }); - describe('new form', function(){ + describe('new form', function() { var form; var scope; var log; @@ -25,7 +25,7 @@ describe('$formFactory', function(){ function WidgetCtrl($formFactory){ this.$formFactory = $formFactory; log += '<init>'; - this.$render = function(){ + this.$render = function() { log += '$render();'; }; this.$on('$validate', function(e){ @@ -41,13 +41,13 @@ describe('$formFactory', function(){ } }; - beforeEach(function(){ + beforeEach(function() { log = ''; scope = rootScope.$new(); form = formFactory(scope); }); - describe('$createWidget', function(){ + describe('$createWidget', function() { var widget; beforeEach(function() { @@ -55,19 +55,20 @@ describe('$formFactory', function(){ scope:scope, model:'text', alias:'text', - controller:WidgetCtrl}); + controller:WidgetCtrl + }); }); - describe('data flow', function(){ - it('should have status properties', function(){ + describe('data flow', function() { + it('should have status properties', function() { expect(widget.$error).toEqual({}); expect(widget.$valid).toBe(true); expect(widget.$invalid).toBe(false); }); - it('should update view when model changes', function(){ + it('should update view when model changes', function() { scope.text = 'abc'; scope.$digest(); expect(log).toEqual('<init>$validate();$render();'); @@ -80,14 +81,14 @@ describe('$formFactory', function(){ }); - it('should have controller prototype methods', function(){ + it('should have controller prototype methods', function() { expect(widget.getFormFactory()).toEqual(formFactory); }); }); - describe('validation', function(){ - it('should update state on error', function(){ + describe('validation', function() { + it('should update state on error', function() { widget.$emit('$invalid', 'E'); expect(widget.$valid).toEqual(false); expect(widget.$invalid).toEqual(true); @@ -98,9 +99,9 @@ describe('$formFactory', function(){ }); - it('should have called the model setter before the validation', function(){ + it('should have called the model setter before the validation', function() { var modelValue; - widget.$on('$validate', function(){ + widget.$on('$validate', function() { modelValue = scope.text; }); widget.$emit('$viewChange', 'abc'); @@ -108,8 +109,8 @@ describe('$formFactory', function(){ }); - describe('form', function(){ - it('should invalidate form when widget is invalid', function(){ + describe('form', function() { + it('should invalidate form when widget is invalid', function() { expect(form.$error).toEqual({}); expect(form.$valid).toEqual(true); expect(form.$invalid).toEqual(false); @@ -147,8 +148,8 @@ describe('$formFactory', function(){ }); - describe('id assignment', function(){ - it('should default to name expression', function(){ + describe('id assignment', function() { + it('should default to name expression', function() { expect(form.text).toEqual(widget); }); @@ -201,7 +202,7 @@ describe('$formFactory', function(){ }); - it('should remove invalid fields from errors, when child widget removed', function(){ + it('should remove invalid fields from errors, when child widget removed', function() { widget.$emit('$invalid', 'MyError'); expect(form.$error.MyError).toEqual([widget]); diff --git a/test/service/locationSpec.js b/test/service/locationSpec.js index a312c1b2..70319af7 100644 --- a/test/service/locationSpec.js +++ b/test/service/locationSpec.js @@ -481,7 +481,7 @@ describe('$location', function() { }); - it('should parse file://', function(){ + it('should parse file://', function() { var match = URL_MATCH.exec('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html'); expect(match[1]).toBe('file'); @@ -492,7 +492,7 @@ describe('$location', function() { }); - it('should parse url with "-" in host', function(){ + it('should parse url with "-" in host', function() { var match = URL_MATCH.exec('http://a-b1.c-d.09/path'); expect(match[1]).toBe('http'); diff --git a/test/service/logSpec.js b/test/service/logSpec.js index 499447ad..c4efb8c5 100644 --- a/test/service/logSpec.js +++ b/test/service/logSpec.js @@ -3,22 +3,22 @@ describe('$log', function() { var scope; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - it('should use console if present', function(){ + it('should use console if present', function() { var logger = ""; - function log(){ logger+= 'log;'; } - function warn(){ logger+= 'warn;'; } - function info(){ logger+= 'info;'; } - function error(){ logger+= 'error;'; } + function log() { logger+= 'log;'; } + function warn() { logger+= 'warn;'; } + function info() { logger+= 'info;'; } + function error() { logger+= 'error;'; } var scope = createScope({$log: $logFactory}, {$exceptionHandler: rethrow, $window: {console: {log: log, @@ -35,9 +35,9 @@ describe('$log', function() { }); - it('should use console.log() if other not present', function(){ + it('should use console.log() if other not present', function() { var logger = ""; - function log(){ logger+= 'log;'; } + function log() { logger+= 'log;'; } var scope = createScope({$log: $logFactory}, {$window: {console:{log:log}}, $exceptionHandler: rethrow}); @@ -50,7 +50,7 @@ describe('$log', function() { }); - it('should use noop if no console', function(){ + it('should use noop if no console', function() { var scope = createScope({$log: $logFactory}, {$window: {}, $exceptionHandler: rethrow}), @@ -62,36 +62,36 @@ describe('$log', function() { }); - describe('$log.error', function(){ + describe('$log.error', function() { var e, $log, errorArgs; - beforeEach(function(){ + beforeEach(function() { e = new Error(''); e.message = undefined; e.sourceURL = undefined; e.line = undefined; e.stack = undefined; - $log = $logFactory({console:{error:function(){ + $log = $logFactory({console:{error:function() { errorArgs = arguments; }}}); }); - it('should pass error if does not have trace', function(){ + it('should pass error if does not have trace', function() { $log.error('abc', e); expect(errorArgs).toEqual(['abc', e]); }); - it('should print stack', function(){ + it('should print stack', function() { e.stack = 'stack'; $log.error('abc', e); expect(errorArgs).toEqual(['abc', 'stack']); }); - it('should print line', function(){ + it('should print line', function() { e.message = 'message'; e.sourceURL = 'sourceURL'; e.line = '123'; diff --git a/test/service/routeParamsSpec.js b/test/service/routeParamsSpec.js index 8cdf3af3..972e4314 100644 --- a/test/service/routeParamsSpec.js +++ b/test/service/routeParamsSpec.js @@ -1,7 +1,7 @@ 'use strict'; -describe('$routeParams', function(){ - it('should publish the params into a service', function(){ +describe('$routeParams', function() { + it('should publish the params into a service', function() { var scope = angular.scope(), $location = scope.$service('$location'), $route = scope.$service('$route'), @@ -20,7 +20,7 @@ describe('$routeParams', function(){ }); - it('should preserve object identity during route reloads', function(){ + it('should preserve object identity during route reloads', function() { var scope = angular.scope(), $location = scope.$service('$location'), $route = scope.$service('$route'), diff --git a/test/service/windowSpec.js b/test/service/windowSpec.js index 3ead3df3..c539e285 100644 --- a/test/service/windowSpec.js +++ b/test/service/windowSpec.js @@ -3,17 +3,17 @@ describe('$window', function() { var scope; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(); }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); - it("should inject $window", function(){ + it("should inject $window", function() { expect(scope.$service('$window')).toBe(window); }); }); diff --git a/test/service/xhr.bulkSpec.js b/test/service/xhr.bulkSpec.js index e35673c7..6b99fbba 100644 --- a/test/service/xhr.bulkSpec.js +++ b/test/service/xhr.bulkSpec.js @@ -3,7 +3,7 @@ describe('$xhr.bulk', function() { var scope, $browser, $browserXhr, $log, $xhrBulk, $xhrError, log; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(angular.service, { '$xhr.error': $xhrError = jasmine.createSpy('$xhr.error'), '$log': $log = {} @@ -16,7 +16,7 @@ describe('$xhr.bulk', function() { }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); @@ -27,7 +27,7 @@ describe('$xhr.bulk', function() { } - it('should collect requests', function(){ + it('should collect requests', function() { $xhrBulk.urls["/"] = {match:/.*/}; $xhrBulk('GET', '/req1', null, callback); $xhrBulk('POST', '/req2', {post:'data'}, callback); @@ -39,13 +39,13 @@ describe('$xhr.bulk', function() { {status:200, response:'first'}, {status:200, response:'second'} ]); - $xhrBulk.flush(function(){ log += 'DONE';}); + $xhrBulk.flush(function() { log += 'DONE';}); $browserXhr.flush(); expect(log).toEqual('"first";"second";DONE'); }); - it('should handle non 200 status code by forwarding to error handler', function(){ + it('should handle non 200 status code by forwarding to error handler', function() { $xhrBulk.urls['/'] = {match:/.*/}; $xhrBulk('GET', '/req1', null, callback); $xhrBulk('POST', '/req2', {post:'data'}, callback); @@ -57,7 +57,7 @@ describe('$xhr.bulk', function() { {status:404, response:'NotFound'}, {status:200, response:'second'} ]); - $xhrBulk.flush(function(){ log += 'DONE';}); + $xhrBulk.flush(function() { log += 'DONE';}); $browserXhr.flush(); expect($xhrError).toHaveBeenCalled(); diff --git a/test/service/xhr.cacheSpec.js b/test/service/xhr.cacheSpec.js index c6b9cfec..0c77e629 100644 --- a/test/service/xhr.cacheSpec.js +++ b/test/service/xhr.cacheSpec.js @@ -12,7 +12,7 @@ describe('$xhr.cache', function() { }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); @@ -23,7 +23,7 @@ describe('$xhr.cache', function() { } - it('should cache requests', function(){ + it('should cache requests', function() { $browserXhr.expectGET('/url').respond('first'); cache('GET', '/url', null, callback); $browserXhr.flush(); @@ -39,7 +39,7 @@ describe('$xhr.cache', function() { }); - it('should first return cache request, then return server request', function(){ + it('should first return cache request, then return server request', function() { $browserXhr.expectGET('/url').respond('first'); cache('GET', '/url', null, callback, true); $browserXhr.flush(); @@ -54,7 +54,7 @@ describe('$xhr.cache', function() { }); - it('should serve requests from cache', function(){ + it('should serve requests from cache', function() { cache.data.url = {value:'123'}; cache('GET', 'url', null, callback); $browser.defer.flush(); @@ -66,7 +66,7 @@ describe('$xhr.cache', function() { }); - it('should keep track of in flight requests and request only once', function(){ + it('should keep track of in flight requests and request only once', function() { scope.$service('$xhr.bulk').urls['/bulk'] = { match:function(url){ return url == '/url'; @@ -85,7 +85,7 @@ describe('$xhr.cache', function() { }); - it('should clear cache on non GET', function(){ + it('should clear cache on non GET', function() { $browserXhr.expectPOST('abc', {}).respond({}); cache.data.url = {value:123}; cache('POST', 'abc', {}); diff --git a/test/service/xhr.errorSpec.js b/test/service/xhr.errorSpec.js index 6cc7fce0..49b63fd0 100644 --- a/test/service/xhr.errorSpec.js +++ b/test/service/xhr.errorSpec.js @@ -3,7 +3,7 @@ describe('$xhr.error', function() { var scope, $browser, $browserXhr, $xhr, $xhrError, log; - beforeEach(function(){ + beforeEach(function() { scope = angular.scope(angular.service, { '$xhr.error': $xhrError = jasmine.createSpy('$xhr.error') }); @@ -14,7 +14,7 @@ describe('$xhr.error', function() { }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); @@ -25,7 +25,7 @@ describe('$xhr.error', function() { } - it('should handle non 200 status codes by forwarding to error handler', function(){ + it('should handle non 200 status codes by forwarding to error handler', function() { $browserXhr.expectPOST('/req', 'MyData').respond(500, 'MyError'); $xhr('POST', '/req', 'MyData', callback); $browserXhr.flush(); diff --git a/test/service/xhrSpec.js b/test/service/xhrSpec.js index b01eb385..2a552403 100644 --- a/test/service/xhrSpec.js +++ b/test/service/xhrSpec.js @@ -3,7 +3,7 @@ describe('$xhr', function() { var scope, $browser, $browserXhr, $log, $xhr, $xhrErr, log; - beforeEach(function(){ + beforeEach(function() { var scope = angular.scope(angular.service, { '$xhr.error': $xhrErr = jasmine.createSpy('xhr.error')}); $log = scope.$service('$log'); @@ -14,7 +14,7 @@ describe('$xhr', function() { }); - afterEach(function(){ + afterEach(function() { dealoc(scope); }); @@ -24,7 +24,7 @@ describe('$xhr', function() { } - it('should forward the request to $browser and decode JSON', function(){ + it('should forward the request to $browser and decode JSON', function() { $browserXhr.expectGET('/reqGET').respond('first'); $browserXhr.expectGET('/reqGETjson').respond('["second"]'); $browserXhr.expectPOST('/reqPOST', {post:'data'}).respond('third'); @@ -41,7 +41,7 @@ describe('$xhr', function() { '{code=200; response="first"}'); }); - it('should allow all 2xx requests', function(){ + it('should allow all 2xx requests', function() { $browserXhr.expectGET('/req1').respond(200, '1'); $xhr('GET', '/req1', null, callback); $browserXhr.flush(); @@ -56,9 +56,9 @@ describe('$xhr', function() { }); - it('should handle exceptions in callback', function(){ + it('should handle exceptions in callback', function() { $browserXhr.expectGET('/reqGET').respond('first'); - $xhr('GET', '/reqGET', null, function(){ throw "MyException"; }); + $xhr('GET', '/reqGET', null, function() { throw "MyException"; }); $browserXhr.flush(); expect($log.error.logs.shift()).toContain('MyException'); @@ -140,7 +140,7 @@ describe('$xhr', function() { describe('default headers', function() { - it('should set default headers for GET request', function(){ + it('should set default headers for GET request', function() { var callback = jasmine.createSpy('callback'); $browserXhr.expectGET('URL', '', {'Accept': 'application/json, text/plain, */*', @@ -153,7 +153,7 @@ describe('$xhr', function() { }); - it('should set default headers for POST request', function(){ + it('should set default headers for POST request', function() { var callback = jasmine.createSpy('callback'); $browserXhr.expectPOST('URL', 'xx', {'Accept': 'application/json, text/plain, */*', @@ -167,7 +167,7 @@ describe('$xhr', function() { }); - it('should set default headers for custom HTTP method', function(){ + it('should set default headers for custom HTTP method', function() { var callback = jasmine.createSpy('callback'); $browserXhr.expect('FOO', 'URL', '', {'Accept': 'application/json, text/plain, */*', @@ -260,8 +260,8 @@ describe('$xhr', function() { }); }); - describe('xsrf', function(){ - it('should copy the XSRF cookie into a XSRF Header', function(){ + describe('xsrf', function() { + it('should copy the XSRF cookie into a XSRF Header', function() { var code, response; $browserXhr .expectPOST('URL', 'DATA', {'X-XSRF-TOKEN': 'secret'}) diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index 41a6455c..b3316c0c 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -11,7 +11,7 @@ _jQuery.event.special.change = undefined; if (window.jstestdriver) { window.jstd = jstestdriver; - window.dump = function dump(){ + window.dump = function dump() { var args = []; forEach(arguments, function(arg){ if (isElement(arg)) { @@ -46,7 +46,7 @@ function dumpScope(scope, offset) { return log.join('\n' + offset); } -beforeEach(function(){ +beforeEach(function() { // This is to reset parsers global cache of expressions. compileCache = {}; @@ -65,7 +65,7 @@ beforeEach(function(){ jqLite(document.body).html(''); function cssMatcher(presentClasses, absentClasses) { - return function(){ + return function() { var element = jqLite(this.actual); var present = true; var absent = false; @@ -78,7 +78,7 @@ beforeEach(function(){ absent = absent || element.hasClass(className); }); - this.message = function(){ + this.message = function() { return "Expected to have " + presentClasses + (absentClasses ? (" and not have " + absentClasses + "" ) : "") + " but had " + element[0].className + "."; @@ -98,7 +98,7 @@ beforeEach(function(){ }, toHaveClass: function(clazz) { - this.message = function(){ + this.message = function() { return "Expected '" + sortedHtml(this.actual) + "' to have class '" + clazz + "'."; }; return this.actual.hasClass ? @@ -191,7 +191,7 @@ afterEach(function() { clearJqCache(); }); -function clearJqCache(){ +function clearJqCache() { var count = 0; forEachSorted(jqCache, function(value, key){ count ++; diff --git a/test/widget/formSpec.js b/test/widget/formSpec.js index 7c575c33..7d136dd8 100644 --- a/test/widget/formSpec.js +++ b/test/widget/formSpec.js @@ -1,35 +1,35 @@ 'use strict'; -describe('form', function(){ +describe('form', function() { var doc; - afterEach(function(){ + afterEach(function() { dealoc(doc); }); - it('should attach form to DOM', function(){ + it('should attach form to DOM', function() { doc = angular.element('<form>'); var scope = angular.compile(doc)(); expect(doc.data('$form')).toBeTruthy(); }); - it('should prevent form submission', function(){ + it('should prevent form submission', function() { var startingUrl = '' + window.location; doc = angular.element('<form name="myForm"><input type=submit val=submit>'); var scope = angular.compile(doc)(); browserTrigger(doc.find('input')); waitsFor( - function(){ return true; }, + function() { return true; }, 'let browser breath, so that the form submision can manifest itself', 10); - runs(function(){ + runs(function() { expect('' + window.location).toEqual(startingUrl); }); }); - it('should publish form to scope', function(){ + it('should publish form to scope', function() { doc = angular.element('<form name="myForm">'); var scope = angular.compile(doc)(); expect(scope.myForm).toBeTruthy(); @@ -38,7 +38,7 @@ describe('form', function(){ }); - it('should have ng-valide/ng-invalid style', function(){ + it('should have ng-valide/ng-invalid style', function() { doc = angular.element('<form name="myForm"><input type=text ng:model=text required>'); var scope = angular.compile(doc)(); scope.text = 'misko'; @@ -54,7 +54,7 @@ describe('form', function(){ }); - it('should chain nested forms', function(){ + it('should chain nested forms', function() { doc = angular.element('<ng:form name=parent><ng:form name=child><input type=text ng:model=text name=text>'); var scope = angular.compile(doc)(); var parent = scope.parent; @@ -71,7 +71,7 @@ describe('form', function(){ }); - it('should chain nested forms in repeater', function(){ + it('should chain nested forms in repeater', function() { doc = angular.element('<ng:form name=parent>' + '<ng:form ng:repeat="f in forms" name=child><input type=text ng:model=text name=text>'); var scope = angular.compile(doc)(); diff --git a/test/widget/inputSpec.js b/test/widget/inputSpec.js index 31f8c59c..d8d7f928 100644 --- a/test/widget/inputSpec.js +++ b/test/widget/inputSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('widget: input', function(){ +describe('widget: input', function() { var compile = null, element = null, scope = null, defer = null; var doc = null; @@ -21,13 +21,13 @@ describe('widget: input', function(){ }; }); - afterEach(function(){ + afterEach(function() { dealoc(element); dealoc(doc); }); - describe('text', function(){ + describe('text', function() { var scope = null, form = null, formElement = null, @@ -46,7 +46,7 @@ describe('widget: input', function(){ }; - it('should bind update scope from model', function(){ + it('should bind update scope from model', function() { createInput(); expect(scope.form.name.$required).toBe(false); scope.name = 'misko'; @@ -55,7 +55,7 @@ describe('widget: input', function(){ }); - it('should require', function(){ + it('should require', function() { createInput({required:''}); expect(scope.form.name.$required).toBe(true); scope.$digest(); @@ -66,10 +66,10 @@ describe('widget: input', function(){ }); - it('should call $destroy on element remove', function(){ + it('should call $destroy on element remove', function() { createInput(); var log = ''; - form.$on('$destroy', function(){ + form.$on('$destroy', function() { log += 'destroy;'; }); inputElement.remove(); @@ -77,10 +77,10 @@ describe('widget: input', function(){ }); - it('should update the model and trim input', function(){ + it('should update the model and trim input', function() { createInput(); var log = ''; - scope.change = function(){ + scope.change = function() { log += 'change();'; }; inputElement.val(' a '); @@ -91,14 +91,14 @@ describe('widget: input', function(){ }); - it('should change non-html5 types to text', function(){ + it('should change non-html5 types to text', function() { doc = angular.element('<form name="form"><input type="abc" ng:model="name"></form>'); scope = angular.compile(doc)(); expect(doc.find('input').attr('type')).toEqual('text'); }); - it('should not change html5 types to text', function(){ + it('should not change html5 types to text', function() { doc = angular.element('<form name="form"><input type="number" ng:model="name"></form>'); scope = angular.compile(doc)(); expect(doc.find('input')[0].getAttribute('type')).toEqual('number'); @@ -106,10 +106,10 @@ describe('widget: input', function(){ }); - describe("input", function(){ + describe("input", function() { - describe("text", function(){ - it('should input-text auto init and handle keydown/change events', function(){ + describe("text", function() { + it('should input-text auto init and handle keydown/change events', function() { compile('<input type="text" ng:model="name"/>'); scope.name = 'Adam'; @@ -130,7 +130,7 @@ describe('widget: input', function(){ }); - it('should not trigger eval if value does not change', function(){ + it('should not trigger eval if value does not change', function() { compile('<input type="text" ng:model="name" ng:change="count = count + 1" ng:init="count=0"/>'); scope.name = 'Misko'; scope.$digest(); @@ -143,7 +143,7 @@ describe('widget: input', function(){ }); - it('should allow complex reference binding', function(){ + it('should allow complex reference binding', function() { compile('<div>'+ '<input type="text" ng:model="obj[\'abc\'].name"/>'+ '</div>'); @@ -153,8 +153,8 @@ describe('widget: input', function(){ }); - describe("ng:format", function(){ - it("should format text", function(){ + describe("ng:format", function() { + it("should format text", function() { compile('<input type="list" ng:model="list"/>'); scope.list = ['x', 'y', 'z']; @@ -168,14 +168,14 @@ describe('widget: input', function(){ }); - it("should render as blank if null", function(){ + it("should render as blank if null", function() { compile('<input type="text" ng:model="age" ng:format="number" ng:init="age=null"/>'); expect(scope.age).toBeNull(); expect(scope.$element[0].value).toEqual(''); }); - it("should show incorrect text while number does not parse", function(){ + it("should show incorrect text while number does not parse", function() { compile('<input type="number" ng:model="age"/>'); scope.age = 123; scope.$digest(); @@ -195,7 +195,7 @@ describe('widget: input', function(){ }); - it("should not clobber text if model changes due to itself", function(){ + it("should not clobber text if model changes due to itself", function() { // When the user types 'a,b' the 'a,' stage parses to ['a'] but if the // $parseModel function runs it will change to 'a', in essence preventing // the user from ever typying ','. @@ -227,7 +227,7 @@ describe('widget: input', function(){ }); - it("should come up blank when no value specified", function(){ + it("should come up blank when no value specified", function() { compile('<input type="number" ng:model="age"/>'); scope.$digest(); expect(scope.$element.val()).toEqual(''); @@ -236,15 +236,15 @@ describe('widget: input', function(){ }); - describe("checkbox", function(){ - it("should format booleans", function(){ + describe("checkbox", function() { + it("should format booleans", function() { compile('<input type="checkbox" ng:model="name" ng:init="name=false"/>'); expect(scope.name).toBe(false); expect(scope.$element[0].checked).toBe(false); }); - it('should support type="checkbox" with non-standard capitalization', function(){ + it('should support type="checkbox" with non-standard capitalization', function() { compile('<input type="checkBox" ng:model="checkbox"/>'); browserTrigger(element); @@ -255,7 +255,7 @@ describe('widget: input', function(){ }); - it('should allow custom enumeration', function(){ + it('should allow custom enumeration', function() { compile('<input type="checkbox" ng:model="name" true-value="ano" false-value="nie"/>'); scope.name='ano'; @@ -280,7 +280,7 @@ describe('widget: input', function(){ }); - it("should process required", function(){ + it("should process required", function() { compile('<input type="text" ng:model="price" name="p" required/>', jqLite(document.body)); expect(scope.$service('$formFactory').rootForm.p.$required).toBe(true); expect(element.hasClass('ng-invalid')).toBeTruthy(); @@ -320,7 +320,7 @@ describe('widget: input', function(){ }); - describe('textarea', function(){ + describe('textarea', function() { it("should process textarea", function() { compile('<textarea ng:model="name"></textarea>'); @@ -341,8 +341,8 @@ describe('widget: input', function(){ }); - describe('radio', function(){ - it('should support type="radio"', function(){ + describe('radio', function() { + it('should support type="radio"', function() { compile('<div>' + '<input type="radio" name="r" ng:model="chose" value="A"/>' + '<input type="radio" name="r" ng:model="chose" value="B"/>' + @@ -366,7 +366,7 @@ describe('widget: input', function(){ }); - it('should honor model over html checked keyword after', function(){ + it('should honor model over html checked keyword after', function() { compile('<div ng:init="choose=\'C\'">' + '<input type="radio" ng:model="choose" value="A""/>' + '<input type="radio" ng:model="choose" value="B" checked/>' + @@ -380,7 +380,7 @@ describe('widget: input', function(){ }); - it('should honor model over html checked keyword before', function(){ + it('should honor model over html checked keyword before', function() { compile('<div ng:init="choose=\'A\'">' + '<input type="radio" ng:model="choose" value="A""/>' + '<input type="radio" ng:model="choose" value="B" checked/>' + @@ -395,22 +395,22 @@ describe('widget: input', function(){ }); - it('should ignore text widget which have no name', function(){ + it('should ignore text widget which have no name', function() { compile('<input type="text"/>'); expect(scope.$element.attr('ng-exception')).toBeFalsy(); expect(scope.$element.hasClass('ng-exception')).toBeFalsy(); }); - it('should ignore checkbox widget which have no name', function(){ + it('should ignore checkbox widget which have no name', function() { compile('<input type="checkbox"/>'); expect(scope.$element.attr('ng-exception')).toBeFalsy(); expect(scope.$element.hasClass('ng-exception')).toBeFalsy(); }); - it('should report error on assignment error', function(){ - expect(function(){ + it('should report error on assignment error', function() { + expect(function() { compile('<input type="text" ng:model="throw \'\'">'); }).toThrow("Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at ['']."); $logMock.error.logs.shift(); @@ -418,8 +418,8 @@ describe('widget: input', function(){ }); - describe('scope declaration', function(){ - it('should read the declaration from scope', function(){ + describe('scope declaration', function() { + it('should read the declaration from scope', function() { var input, $formFactory; element = angular.element('<input type="@MyType" ng:model="abc">'); scope = angular.scope(); @@ -451,18 +451,18 @@ describe('widget: input', function(){ }); - describe('text subtypes', function(){ + describe('text subtypes', function() { function itShouldVerify(type, validList, invalidList, params, fn) { - describe(type, function(){ + describe(type, function() { forEach(validList, function(value){ - it('should validate "' + value + '"', function(){ + it('should validate "' + value + '"', function() { setup(value); expect(scope.$element).toBeValid(); }); }); forEach(invalidList, function(value){ - it('should NOT validate "' + value + '"', function(){ + it('should NOT validate "' + value + '"', function() { setup(value); expect(scope.$element).toBeInvalid(); }); diff --git a/test/widget/selectSpec.js b/test/widget/selectSpec.js index 6adf8b93..ad9dab18 100644 --- a/test/widget/selectSpec.js +++ b/test/widget/selectSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('select', function(){ +describe('select', function() { var compile = null, element = null, scope = null, $formFactory = null; beforeEach(function() { @@ -20,12 +20,12 @@ describe('select', function(){ }; }); - afterEach(function(){ + afterEach(function() { dealoc(element); }); - describe('select-one', function(){ + describe('select-one', function() { it('should compile children of a select without a name, but not create a model for it', function() { @@ -41,7 +41,7 @@ describe('select', function(){ expect(scope.$element.text()).toBe('foobarC'); }); - it('should require', function(){ + it('should require', function() { compile('<select name="select" ng:model="selection" required ng:change="log=log+\'change;\'">' + '<option value=""></option>' + '<option value="c">C</option>' + @@ -67,7 +67,7 @@ describe('select', function(){ expect(scope.log).toEqual('change;'); }); - it('should not be invalid if no require', function(){ + it('should not be invalid if no require', function() { compile('<select name="select" ng:model="selection">' + '<option value=""></option>' + '<option value="c">C</option>' + @@ -80,8 +80,8 @@ describe('select', function(){ }); - describe('select-multiple', function(){ - it('should support type="select-multiple"', function(){ + describe('select-multiple', function() { + it('should support type="select-multiple"', function() { compile('<select ng:model="selection" multiple>' + '<option>A</option>' + '<option>B</option>' + @@ -91,7 +91,7 @@ describe('select', function(){ expect(element[0].childNodes[0].selected).toEqual(true); }); - it('should require', function(){ + it('should require', function() { compile('<select name="select" ng:model="selection" multiple required>' + '<option>A</option>' + '<option>B</option>' + @@ -117,7 +117,7 @@ describe('select', function(){ }); - describe('ng:options', function(){ + describe('ng:options', function() { var select, scope; function createSelect(attrs, blank, unknown){ @@ -152,19 +152,19 @@ describe('select', function(){ }, blank, unknown); } - afterEach(function(){ + afterEach(function() { dealoc(select); dealoc(scope); }); - it('should throw when not formated "? for ? in ?"', function(){ - expect(function(){ + it('should throw when not formated "? for ? in ?"', function() { + expect(function() { compile('<select ng:model="selected" ng:options="i dont parse"></select>'); }).toThrow("Expected ng:options in form of '_select_ (as _label_)? for (_key_,)?_value_ in" + " _collection_' but got 'i dont parse'."); }); - it('should render a list', function(){ + it('should render a list', function() { createSingleSelect(); scope.values = [{name:'A'}, {name:'B'}, {name:'C'}]; scope.selected = scope.values[0]; @@ -176,7 +176,7 @@ describe('select', function(){ expect(sortedHtml(options[2])).toEqual('<option value="2">C</option>'); }); - it('should render an object', function(){ + it('should render an object', function() { createSelect({ 'ng:model':'selected', 'ng:options': 'value as key for (key, value) in object' @@ -197,7 +197,7 @@ describe('select', function(){ expect(options[3].selected).toEqual(true); }); - it('should grow list', function(){ + it('should grow list', function() { createSingleSelect(); scope.values = []; scope.$digest(); @@ -217,7 +217,7 @@ describe('select', function(){ expect(sortedHtml(select.find('option')[1])).toEqual('<option value="1">B</option>'); }); - it('should shrink list', function(){ + it('should shrink list', function() { createSingleSelect(); scope.values = [{name:'A'}, {name:'B'}, {name:'C'}]; scope.selected = scope.values[0]; @@ -241,7 +241,7 @@ describe('select', function(){ expect(select.find('option').length).toEqual(1); // we add back the special empty option }); - it('should shrink and then grow list', function(){ + it('should shrink and then grow list', function() { createSingleSelect(); scope.values = [{name:'A'}, {name:'B'}, {name:'C'}]; scope.selected = scope.values[0]; @@ -259,7 +259,7 @@ describe('select', function(){ expect(select.find('option').length).toEqual(3); }); - it('should update list', function(){ + it('should update list', function() { createSingleSelect(); scope.values = [{name:'A'}, {name:'B'}, {name:'C'}]; scope.selected = scope.values[0]; @@ -275,7 +275,7 @@ describe('select', function(){ expect(sortedHtml(options[2])).toEqual('<option value="2">D</option>'); }); - it('should preserve existing options', function(){ + it('should preserve existing options', function() { createSingleSelect(true); scope.values = []; @@ -296,8 +296,8 @@ describe('select', function(){ expect(jqLite(select.find('option')[0]).text()).toEqual('blank'); }); - describe('binding', function(){ - it('should bind to scope value', function(){ + describe('binding', function() { + it('should bind to scope value', function() { createSingleSelect(); scope.values = [{name:'A'}, {name:'B'}]; scope.selected = scope.values[0]; @@ -309,7 +309,7 @@ describe('select', function(){ expect(select.val()).toEqual('1'); }); - it('should bind to scope value and group', function(){ + it('should bind to scope value and group', function() { createSelect({ 'ng:model':'selected', 'ng:options':'item.name group by item.group for item in values' @@ -342,7 +342,7 @@ describe('select', function(){ expect(select.val()).toEqual('0'); }); - it('should bind to scope value through experession', function(){ + it('should bind to scope value through experession', function() { createSelect({'ng:model':'selected', 'ng:options':'item.id as item.name for item in values'}); scope.values = [{id:10, name:'A'}, {id:20, name:'B'}]; scope.selected = scope.values[0].id; @@ -354,7 +354,7 @@ describe('select', function(){ expect(select.val()).toEqual('1'); }); - it('should bind to object key', function(){ + it('should bind to object key', function() { createSelect({ 'ng:model':'selected', 'ng:options':'key as value for (key, value) in object' @@ -369,7 +369,7 @@ describe('select', function(){ expect(select.val()).toEqual('blue'); }); - it('should bind to object value', function(){ + it('should bind to object value', function() { createSelect({ 'ng:model':'selected', 'ng:options':'value as key for (key, value) in object' @@ -384,7 +384,7 @@ describe('select', function(){ expect(select.val()).toEqual('blue'); }); - it('should insert a blank option if bound to null', function(){ + it('should insert a blank option if bound to null', function() { createSingleSelect(); scope.values = [{name:'A'}]; scope.selected = null; @@ -399,7 +399,7 @@ describe('select', function(){ expect(select.find('option').length).toEqual(1); }); - it('should reuse blank option if bound to null', function(){ + it('should reuse blank option if bound to null', function() { createSingleSelect(true); scope.values = [{name:'A'}]; scope.selected = null; @@ -414,7 +414,7 @@ describe('select', function(){ expect(select.find('option').length).toEqual(2); }); - it('should insert a unknown option if bound to something not in the list', function(){ + it('should insert a unknown option if bound to something not in the list', function() { createSingleSelect(); scope.values = [{name:'A'}]; scope.selected = {}; @@ -430,8 +430,8 @@ describe('select', function(){ }); }); - describe('on change', function(){ - it('should update model on change', function(){ + describe('on change', function() { + it('should update model on change', function() { createSingleSelect(); scope.values = [{name:'A'}, {name:'B'}]; scope.selected = scope.values[0]; @@ -443,7 +443,7 @@ describe('select', function(){ expect(scope.selected).toEqual(scope.values[1]); }); - it('should update model on change through expression', function(){ + it('should update model on change through expression', function() { createSelect({'ng:model':'selected', 'ng:options':'item.id as item.name for item in values'}); scope.values = [{id:10, name:'A'}, {id:20, name:'B'}]; scope.selected = scope.values[0].id; @@ -455,7 +455,7 @@ describe('select', function(){ expect(scope.selected).toEqual(scope.values[1].id); }); - it('should update model to null on change', function(){ + it('should update model to null on change', function() { createSingleSelect(true); scope.values = [{name:'A'}, {name:'B'}]; scope.selected = scope.values[0]; @@ -468,8 +468,8 @@ describe('select', function(){ }); }); - describe('select-many', function(){ - it('should read multiple selection', function(){ + describe('select-many', function() { + it('should read multiple selection', function() { createMultiSelect(); scope.values = [{name:'A'}, {name:'B'}]; @@ -492,7 +492,7 @@ describe('select', function(){ expect(select.find('option')[1].selected).toEqual(true); }); - it('should update model on change', function(){ + it('should update model on change', function() { createMultiSelect(); scope.values = [{name:'A'}, {name:'B'}]; diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 9361d28d..b6754b91 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe("widget", function(){ +describe("widget", function() { var compile = null, element = null, scope = null; beforeEach(function() { @@ -24,8 +24,8 @@ describe("widget", function(){ }); - describe('ng:switch', function(){ - it('should switch on value change', function(){ + describe('ng:switch', function() { + it('should switch on value change', function() { compile('<ng:switch on="select">' + '<div ng:switch-when="1">first:{{name}}</div>' + '<div ng:switch-when="2">second:{{name}}</div>' + |
