From acbd7cdf320f0570fcc1952c8680d4c78bc8fa2c Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Fri, 11 Nov 2011 17:15:22 -0800 Subject: style(docs): make jslint happy - fix some warnings --- docs/spec/ngdocSpec.js | 69 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'docs/spec/ngdocSpec.js') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 46b9d867..8f109e92 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -54,6 +54,7 @@ describe('ngdoc', function() { it('should parse parameters', function() { var doc = new Doc( + '@name a\n' + '@param {*} a short\n' + '@param {Type} b med\n' + '@param {Class=} [c=2] long\nline'); @@ -66,7 +67,7 @@ describe('ngdoc', function() { }); it('should parse return', function() { - var doc = new Doc('@returns {Type} text *bold*.'); + var doc = new Doc('@name a\n@returns {Type} text *bold*.'); doc.parse(); expect(doc.returns).toEqual({ type: 'Type', @@ -82,7 +83,7 @@ describe('ngdoc', function() { }); it('should escape element', function() { - var doc = new Doc('@description before ' + + var doc = new Doc('@name a\n@description before ' + '\n<>\n after'); doc.parse(); expect(doc.description).toContain('

before

' + @@ -90,7 +91,7 @@ describe('ngdoc', function() { }); it('should preserve the source attribute', function() { - var doc = new Doc('@description before ' + + var doc = new Doc('@name a\n@description before ' + 'lala after'); doc.parse(); expect(doc.description).toContain('

before

' + @@ -98,7 +99,7 @@ describe('ngdoc', function() { }); it('should preserve the jsfiddle attribute', function() { - var doc = new Doc('@description before ' + + var doc = new Doc('@name a\n@description before ' + 'lala after'); doc.parse(); expect(doc.description).toContain('

before

' + @@ -106,7 +107,7 @@ describe('ngdoc', function() { }); it('should escape element', function() { - var doc = new Doc('@description before ' + + var doc = new Doc('@name a\n@description before ' + '\n<>\n after'); doc.parse(); expect(doc.description).toContain('

before

' + @@ -114,7 +115,7 @@ describe('ngdoc', function() { }); it('should store all links', function() { - var doc = new Doc('@description {@link api/angular.link}'); + var doc = new Doc('@name a\n@description {@link api/angular.link}'); doc.parse(); expect(doc.links).toContain('api/angular.link'); @@ -255,17 +256,17 @@ describe('ngdoc', function() { describe('merge', function() { it('should merge child with parent', function() { - var parent = new Doc({id: 'angular.module.NG.abc', name: 'angular.module.NG.abc', section: 'api'}); - var methodA = new Doc({name: 'methodA', methodOf: 'angular.module.NG.abc'}); - var methodB = new Doc({name: 'methodB', methodOf: 'angular.module.NG.abc'}); - var propA = new Doc({name: 'propA', propertyOf: 'angular.module.NG.abc'}); - var propB = new Doc({name: 'propB', propertyOf: 'angular.module.NG.abc'}); - var eventA = new Doc({name: 'eventA', eventOf: 'angular.module.NG.abc'}); - var eventB = new Doc({name: 'eventB', eventOf: 'angular.module.NG.abc'}); + var parent = new Doc({id: 'angular.module.ng.abc', name: 'angular.module.ng.abc', section: 'api'}); + var methodA = new Doc({name: 'methodA', methodOf: 'angular.module.ng.abc'}); + var methodB = new Doc({name: 'methodB', methodOf: 'angular.module.ng.abc'}); + var propA = new Doc({name: 'propA', propertyOf: 'angular.module.ng.abc'}); + var propB = new Doc({name: 'propB', propertyOf: 'angular.module.ng.abc'}); + var eventA = new Doc({name: 'eventA', eventOf: 'angular.module.ng.abc'}); + var eventB = new Doc({name: 'eventB', eventOf: 'angular.module.ng.abc'}); var docs = [methodB, methodA, eventB, eventA, propA, propB, parent]; // keep wrong order; ngdoc.merge(docs); expect(docs.length).toEqual(1); - expect(docs[0].id).toEqual('angular.module.NG.abc'); + expect(docs[0].id).toEqual('angular.module.ng.abc'); expect(docs[0].methods).toEqual([methodA, methodB]); expect(docs[0].events).toEqual([eventA, eventB]); expect(docs[0].properties).toEqual([propA, propB]); @@ -305,7 +306,7 @@ describe('ngdoc', function() { describe('TAG', function() { describe('@param', function() { it('should parse with no default', function() { - var doc = new Doc('@param {(number|string)} number Number \n to format.'); + var doc = new Doc('@name a\n@param {(number|string)} number Number \n to format.'); doc.parse(); expect(doc.param).toEqual([{ type : '(number|string)', @@ -316,7 +317,7 @@ describe('ngdoc', function() { }); it('should parse with default and optional', function() { - var doc = new Doc('@param {(number|string)=} [fractionSize=2] desc'); + var doc = new Doc('@name a\n@param {(number|string)=} [fractionSize=2] desc'); doc.parse(); expect(doc.param).toEqual([{ type : '(number|string)', @@ -329,14 +330,14 @@ describe('ngdoc', function() { describe('@requires', function() { it('should parse more @requires tag into array', function() { - var doc = new Doc('@requires $service for \n`A`\n@requires $another for `B`'); + var doc = new Doc('@name a\n@requires $service for \n`A`\n@requires $another for `B`'); doc.ngdoc = 'service'; doc.parse(); expect(doc.requires).toEqual([ {name:'$service', text:'

for \nA

'}, {name:'$another', text:'

for B

'}]); - expect(doc.html()).toContain('$service'); - expect(doc.html()).toContain('$another'); + expect(doc.html()).toContain('$service'); + expect(doc.html()).toContain('$another'); expect(doc.html()).toContain('

for \nA

'); expect(doc.html()).toContain('

for B

'); }); @@ -344,7 +345,7 @@ describe('ngdoc', function() { describe('@property', function() { it('should parse @property tags into array', function() { - var doc = new Doc("@property {type} name1 desc\n@property {type} name2 desc"); + var doc = new Doc("@name a\n@property {type} name1 desc\n@property {type} name2 desc"); doc.parse(); expect(doc.properties.length).toEqual(2); }); @@ -356,21 +357,21 @@ describe('ngdoc', function() { }); it('should parse @property with type', function() { - var doc = new Doc("@property {string} name"); + var doc = new Doc("@name a\n@property {string} name"); doc.parse(); expect(doc.properties[0].name).toEqual('name'); expect(doc.properties[0].type).toEqual('string'); }); it('should parse @property with optional description', function() { - var doc = new Doc("@property {string} name desc rip tion"); + var doc = new Doc("@name a\n@property {string} name desc rip tion"); doc.parse(); expect(doc.properties[0].name).toEqual('name'); expect(doc.properties[0].description).toEqual('

desc rip tion

'); }); it('should parse @property with type and description both', function() { - var doc = new Doc("@property {bool} name desc rip tion"); + var doc = new Doc("@name a\n@property {bool} name desc rip tion"); doc.parse(); expect(doc.properties[0].name).toEqual('name'); expect(doc.properties[0].type).toEqual('bool'); @@ -386,19 +387,19 @@ describe('ngdoc', function() { }); it('should parse @returns with type and description', function() { - var doc = new Doc("@returns {string} descrip tion"); + var doc = new Doc("@name a\n@returns {string} descrip tion"); doc.parse(); expect(doc.returns).toEqual({type: 'string', description: '

descrip tion

'}); }); it('should transform description of @returns with markdown', function() { - var doc = new Doc("@returns {string} descrip *tion*"); + var doc = new Doc("@name a\n@returns {string} descrip *tion*"); doc.parse(); expect(doc.returns).toEqual({type: 'string', description: '

descrip tion

'}); }); it('should support multiline content', function() { - var doc = new Doc("@returns {string} description\n new line\n another line"); + var doc = new Doc("@name a\n@returns {string} description\n new line\n another line"); doc.parse(); expect(doc.returns). toEqual({type: 'string', description: '

description\nnew line\nanother line

'}); @@ -407,14 +408,14 @@ describe('ngdoc', function() { describe('@description', function() { it('should support pre blocks', function() { - var doc = new Doc("@description
abc
"); + var doc = new Doc("@name a\n@description
abc
"); doc.parse(); expect(doc.description). toBe('
<b>abc</b>
'); }); it('should support multiple pre blocks', function() { - var doc = new Doc("@description foo \n
abc
\n#bah\nfoo \n
cba
"); + var doc = new Doc("@name a\n@description foo \n
abc
\n#bah\nfoo \n
cba
"); doc.parse(); expect(doc.description). toBe('

foo

' + @@ -426,7 +427,7 @@ describe('ngdoc', function() { }); it('should support nested @link annotations with or without description', function() { - var doc = new Doc("@description " + + var doc = new Doc("@name a\n@description " + 'foo {@link angular.foo}\n\n da {@link angular.foo bar foo bar } \n\n' + 'dad{@link angular.foo}\n\n' + 'external{@link http://angularjs.org}\n\n' + @@ -451,7 +452,7 @@ describe('ngdoc', function() { }); it('should support line breaks in @link', function() { - var doc = new Doc("@description " + + var doc = new Doc("@name a\n@description " + '{@link\napi/angular.foo\na\nb}'); doc.parse(); expect(doc.description). @@ -462,13 +463,13 @@ describe('ngdoc', function() { describe('@example', function() { it('should not remove {{}}', function() { - var doc = new Doc('@example text {{ abc }}'); + var doc = new Doc('@name a\n@example text {{ abc }}'); doc.parse(); expect(doc.example).toEqual('

text {{ abc }}

'); }); it('should support doc:example', function() { - var doc = new Doc('@ngdoc overview\n@example \n' + + var doc = new Doc('@name a\n@ngdoc overview\n@example \n' + '\n' + ' \n' + ' \n' + @@ -482,7 +483,7 @@ describe('ngdoc', function() { describe('@deprecated', function() { it('should parse @deprecated', function() { - var doc = new Doc('@deprecated Replaced with foo.'); + var doc = new Doc('@name a\n@deprecated Replaced with foo.'); doc.parse(); expect(doc.deprecated).toBe('Replaced with foo.'); }); @@ -490,7 +491,7 @@ describe('ngdoc', function() { describe('@this', function() { it('should render @this', function() { - var doc = new Doc('@this I am self.'); + var doc = new Doc('@name a\n@this I am self.'); doc.ngdoc = 'filter'; doc.parse(); expect(doc.html()).toContain('

Method\'s this

\n' + -- cgit v1.2.3