From fd822bdaf9d04e522aaa5400b673f333190abe98 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 7 Oct 2011 11:27:49 -0700 Subject: chore(formating): clean code to be function() { --- test/AngularSpec.js | 48 ++++++------ test/ApiSpecs.js | 2 +- test/BinderSpec.js | 98 ++++++++++++------------ test/BrowserSpecs.js | 30 ++++---- test/CompilerSpec.js | 32 ++++---- test/FiltersSpec.js | 4 +- test/InjectorSpec.js | 76 +++++++++---------- test/JsonSpec.js | 56 +++++++------- test/ParserSpec.js | 6 +- test/ResourceSpec.js | 42 +++++------ test/ScenarioSpec.js | 14 ++-- test/ScopeSpec.js | 8 +- test/angular-mocksSpec.js | 14 ++-- test/directivesSpec.js | 18 ++--- test/jQueryPatchSpec.js | 20 ++--- test/jqLiteSpec.js | 116 ++++++++++++++--------------- test/jstd-scenario-adapter/AdapterSpecs.js | 2 +- test/manual.html | 4 +- test/markupSpec.js | 44 +++++------ test/mocks.js | 8 +- test/sanitizerSpec.js | 92 +++++++++++------------ test/scenario/DescribeSpec.js | 4 +- test/scenario/dslSpec.js | 2 +- test/scenario/e2e/widgets-scenario.js | 2 +- test/service/cookieStoreSpec.js | 2 +- test/service/cookiesSpec.js | 6 +- test/service/deferSpec.js | 6 +- test/service/documentSpec.js | 6 +- test/service/exceptionHandlerSpec.js | 6 +- test/service/formFactorySpec.js | 43 +++++------ test/service/locationSpec.js | 4 +- test/service/logSpec.js | 32 ++++---- test/service/routeParamsSpec.js | 6 +- test/service/windowSpec.js | 6 +- test/service/xhr.bulkSpec.js | 12 +-- test/service/xhr.cacheSpec.js | 12 +-- test/service/xhr.errorSpec.js | 6 +- test/service/xhrSpec.js | 22 +++--- test/testabilityPatch.js | 12 +-- test/widget/formSpec.js | 20 ++--- test/widget/inputSpec.js | 84 ++++++++++----------- test/widget/selectSpec.js | 70 ++++++++--------- test/widgetsSpec.js | 6 +- 43 files changed, 552 insertions(+), 551 deletions(-) (limited to 'test') 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('
{{greeting = "hello world"}}
'); 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('
{{greeting = "hello world"}}
'); 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('
{{greeting = "hello world"}}
'); @@ -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('
{{greeting = "hello world"}}
'); 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('
'); scope.$digest(); assertEquals(123, scope.a); }); - it('ExecuteInitialization', function(){ + it('ExecuteInitialization', function() { var scope = this.compile('
'); assertEquals(scope.a, 123); }); - it('ExecuteInitializationStatements', function(){ + it('ExecuteInitializationStatements', function() { var scope = this.compile('
'); assertEquals(scope.a, 123); assertEquals(scope.b, 345); }); - it('ApplyTextBindings', function(){ + it('ApplyTextBindings', function() { var scope = this.compile('
x
'); scope.model = {a:123}; scope.$apply(); assertEquals('123', scope.$element.text()); }); - it('ReplaceBindingInTextWithSpan', function(){ + it('ReplaceBindingInTextWithSpan', function() { assertEquals(this.compileToHtml("a{{b}}c"), 'ac'); assertEquals(this.compileToHtml("{{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("{{A}} x {{B}} ({{C}})")); }); - it('BindingOfAttributes', function(){ + it('BindingOfAttributes', function() { var scope = this.compile(""); 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(''); 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(""); 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(""); 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(''); 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(''); 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(''); - 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(''); 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('
'); 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('
'); scope.model = {items:[{a:"A"}]}; scope.$apply(); @@ -186,12 +186,12 @@ describe('Binder', function(){ '', sortedHtml(scope.$element)); }); - it('DoNotOverwriteCustomAction', function(){ + it('DoNotOverwriteCustomAction', function() { var html = this.compileToHtml(''); assertTrue(html.indexOf('action="foo();"') > 0 ); }); - it('RepeaterAdd', function(){ + it('RepeaterAdd', function() { var scope = this.compile('
'); 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('
{{i}}
'); 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('
{{error.throw()}}
', 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('
', 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('
' + '
    ' + '
    '); @@ -282,7 +282,7 @@ describe('Binder', function(){ '
    ', sortedHtml(scope.$element)); }); - it('HideBindingExpression', function(){ + it('HideBindingExpression', function() { var scope = this.compile('
    '); scope.hidden = 3; @@ -296,7 +296,7 @@ describe('Binder', function(){ assertVisible(scope.$element); }); - it('HideBinding', function(){ + it('HideBinding', function() { var scope = this.compile('
    '); scope.hidden = 'true'; @@ -315,7 +315,7 @@ describe('Binder', function(){ assertVisible(scope.$element); }); - it('ShowBinding', function(){ + it('ShowBinding', function() { var scope = this.compile('
    '); scope.show = 'true'; @@ -335,7 +335,7 @@ describe('Binder', function(){ }); - it('BindClass', function(){ + it('BindClass', function() { var scope = this.compile('
    '); scope.clazz = 'testClass'; @@ -349,7 +349,7 @@ describe('Binder', function(){ assertEquals('
    ', sortedHtml(scope.$element)); }); - it('BindClassEvenOdd', function(){ + it('BindClassEvenOdd', function() { var scope = this.compile('
    '); 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('
    '); scope.$eval('style={height: "10px"}'); @@ -375,9 +375,9 @@ describe('Binder', function(){ scope.$apply(); }); - it('ActionOnAHrefThrowsError', function(){ + it('ActionOnAHrefThrowsError', function() { var scope = this.compile('Add Phone', 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("
    {{a}}" + "
    {{a}}
    " + "
    {{b}}
    " + @@ -403,7 +403,7 @@ describe('Binder', function(){ assertEquals('
    Hello World!
    ', sortedHtml(scope.$element)); }); - it('FillInOptionValueWhenMissing', function(){ + it('FillInOptionValueWhenMissing', function() { var scope = this.compile( '' + '' + @@ -449,7 +449,7 @@ describe('Binder', function(){ assertChild(5, false); }); - it('ItShouldDisplayErrorWhenActionIsSyntacticlyIncorrect', function(){ + it('ItShouldDisplayErrorWhenActionIsSyntacticlyIncorrect', function() { var scope = this.compile('
    ' + '' + '
    ', 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('
    ' + '' + '
    '); @@ -486,7 +486,7 @@ describe('Binder', function(){ assertEquals("male", male.val()); }); - it('ItShouldRepeatOnHashes', function(){ + it('ItShouldRepeatOnHashes', function() { var scope = this.compile('
    '); scope.$apply(); assertEquals('
      ' + @@ -497,7 +497,7 @@ describe('Binder', function(){ sortedHtml(scope.$element)); }); - it('ItShouldFireChangeListenersBeforeUpdate', function(){ + it('ItShouldFireChangeListenersBeforeUpdate', function() { var scope = this.compile('
      '); 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('
      {{\n 1 \n + \n 2 \n}}
      '); 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('
      A
      '); }).toThrow("Cannot compile multiple element roots: " + ie("
      A
      ")); 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('
      '); 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('
      '); expect(log).toEqual("hello misko"); }); - it('should observe scope', function(){ + it('should observe scope', function() { scope = compile(''); 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(''); 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('
      button
      '); @@ -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('abc'); 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('
      ')(); 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('
      ')(); 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('
      {{b=a+1}}
      ')[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('
      {{a=123}}
      '))(); 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('
      {{a=123}}
      ')(); 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('hello'); }); - 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('
      {{ {key:"value", $$key:"hide"} }}
      '); 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('
      {{ {key:"value", $$key:"hide"}  }}
      '); 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('
      '); 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('
      '); 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('
      '); 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('
      '), 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('bla'); }); - it('should fire on replaceAll()', function(){ + it('should fire on replaceAll()', function() { $('bla').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('
      A
      ')[0]; b = jqLite('
      B
      ')[0]; c = jqLite('
      C
      ')[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('
      1
      2'); 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('').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('
      abc
      '); 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(''); 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('
      abc
      '); 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('
      ').html('before-
      after'); var div = root.find('div'); expect(div.replaceWith('span-bold-')).toEqual(div); @@ -673,7 +673,7 @@ describe('jqLite', function(){ }); - it('should replaceWith text', function(){ + it('should replaceWith text', function() { var root = jqLite('
      ').html('before-
      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('
      ').html('before-
      after-'); 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('
      '); expect(root.append('abc')).toEqual(root); expect(root.html().toLowerCase()).toEqual('abc'); }); - it('should append text', function(){ + it('should append text', function() { var root = jqLite('
      '); 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('
      '); expect(root.prepend('abc')).toEqual(root); expect(root.html().toLowerCase()).toEqual('abc'); }); - it('should prepend to content', function(){ + it('should prepend to content', function() { var root = jqLite('
      text
      '); expect(root.prepend('abc')).toEqual(root); expect(root.html().toLowerCase()).toEqual('abctext'); }); - it('should prepend text to content', function(){ + it('should prepend text to content', function() { var root = jqLite('
      text
      '); 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('
      abc
      '); 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('
      '); var span = root.find('span'); expect(span.after('')).toEqual(span); @@ -748,7 +748,7 @@ describe('jqLite', function(){ }); - it('should allow taking text', function(){ + it('should allow taking text', function() { var root = jqLite('
      '); 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('

      abc

      '), 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('
      bi
      '); 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('
      text
      '); 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 @@ c.').toEqual('ac.'); }); - it('should remove double nested script', function(){ + it('should remove double nested script', function() { expectHTML('ailc.').toEqual('ac.'); }); - it('should remove unknown names', function(){ + it('should remove unknown names', function() { expectHTML('abc').toEqual('abc'); }); - it('should remove unsafe value', function(){ + it('should remove unsafe value', function() { expectHTML('').toEqual(''); }); - it('should handle self closed elements', function(){ + it('should handle self closed elements', function() { expectHTML('a
      c').toEqual('a
      c'); }); - it('should handle namespace', function(){ + it('should handle namespace', function() { expectHTML('abc').toEqual('abc'); }); - it('should handle entities', function(){ + it('should handle entities', function() { var everything = '
      ' + '!@#$%^&*()_+-={}[]:";\'<>?,./`~ ħ
      '; expectHTML(everything).toEqual(everything); }); - it('should handle improper html', function(){ + it('should handle improper html', function() { expectHTML('< div rel="
      " alt=abc dir=\'"\' >text< /div>'). toEqual('
      text
      '); }); - it('should handle improper html2', function(){ + it('should handle improper html2', function() { expectHTML('< div rel="
      " / >'). toEqual('
      '); }); - it('should ignore back slash as escape', function(){ + it('should ignore back slash as escape', function() { expectHTML('xxx\\'). toEqual('xxx\\'); }); - it('should ignore object attributes', function(){ + it('should ignore object attributes', function() { expectHTML(':)'). toEqual(':)'); expectHTML(':)'). 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
      in
      after'); }); - it('should escape text nodes', function(){ + it('should escape text nodes', function() { writer.chars('a
      &
      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('
      '); }); - 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('
      '); }); - 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('
      '); }); - 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( ''); 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('
      '); 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(''); 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(''); 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('' + ''); 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(''); 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('
      '); 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(''); 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(''); 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('
      '+ ''+ '
      '); @@ -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(''); 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(''); 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(''); 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(''); 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(''); 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(''); browserTrigger(element); @@ -255,7 +255,7 @@ describe('widget: input', function(){ }); - it('should allow custom enumeration', function(){ + it('should allow custom enumeration', function() { compile(''); scope.name='ano'; @@ -280,7 +280,7 @@ describe('widget: input', function(){ }); - it("should process required", function(){ + it("should process required", function() { compile('', 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(''); @@ -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('
      ' + '' + '' + @@ -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('
      ' + '' + '' + @@ -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('
      ' + '' + '' + @@ -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(''); 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(''); 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(''); }).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(''); 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('' + '' + '' + @@ -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('' + '' + '' + @@ -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(''); }).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(''); }); - 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(''); }); - 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(''); }); - 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('' + '
      first:{{name}}
      ' + '
      second:{{name}}
      ' + -- cgit v1.2.3