From 77c715d7caedf9dd56b07b451dc47480cac5aaff Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Tue, 9 Jul 2013 18:08:23 -0400 Subject: chore(ngdoc): wrap all pages inside of a container tag for easy styling --- docs/spec/ngdocSpec.js | 64 +++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 24 deletions(-) (limited to 'docs/spec') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 7a038e89..128e0106 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -59,10 +59,10 @@ describe('ngdoc', function() { '@param {function(number, string=)} d fn with optional arguments'); doc.parse(); expect(doc.param).toEqual([ - {name:'a', description:'

short

', type:'*', optional:false, 'default':undefined}, - {name:'b', description:'

med

', type:'Type', optional:false, 'default':undefined}, - {name:'c', description:'

long\nline

', type:'Class', optional:true, 'default':'2'}, - {name:'d', description:'

fn with optional arguments

', + {name:'a', description:'

short

', type:'*', optional:false, 'default':undefined}, + {name:'b', description:'

med

', type:'Type', optional:false, 'default':undefined}, + {name:'c', description:'

long\nline

', type:'Class', optional:true, 'default':'2'}, + {name:'d', description:'

fn with optional arguments

', type: 'function(number, string=)', optional: false, 'default':undefined} ]); }); @@ -72,7 +72,7 @@ describe('ngdoc', function() { doc.parse(); expect(doc.returns).toEqual({ type: 'Type', - description: '

text bold.

' + description: '

text bold.

' }); }); @@ -138,11 +138,25 @@ describe('ngdoc', function() { it('should not replace anything in
, but escape the html escape the content', function() {
       expect(new Doc().markdown('bah x\n
\nangular.k\n
\n asdf x')). toEqual( - '

bah x\n' + + '

bah x\n' + '

\n' +
             '<b>angular</b>.k\n' +
             '
\n' + - ' asdf x

'); + ' asdf x

'); + }); + + it('should wrap everything inside a container tag', function() { + var doc = new Doc('@name superman').parse(); + var content = doc.markdown('hello'); + + expect(content).toMatch('

hello

'); + }); + + it('should use the content before a colon as the name prefix for the className of the tag container', function() { + var doc = new Doc('@name super: man').parse(); + var content = doc.markdown('hello'); + + expect(content).toMatch('

hello

'); }); it('should replace text between two
 tags', function() {
@@ -162,11 +176,11 @@ describe('ngdoc', function() {
           '\ngit bla bla\n\n' +
         '')).toEqual(
 
-        '

before

\n' + + '

before

\n' + '
\n' + 'git bla bla\n' + '\n' + - '

'); + '

'); }); it('should unindent text before processing based on the second line', function() { @@ -290,7 +304,7 @@ describe('ngdoc', function() { name : 'number', optional: false, 'default' : undefined, - description : '

Number \nto format.

' }]); + description : '

Number \nto format.

' }]); }); it('should parse with default and optional', function() { @@ -301,7 +315,7 @@ describe('ngdoc', function() { name : 'fractionSize', optional: true, 'default' : '2', - description : '

desc

' }]); + description : '

desc

' }]); }); }); @@ -311,8 +325,8 @@ describe('ngdoc', function() { doc.ngdoc = 'service'; doc.parse(); expect(doc.requires).toEqual([ - {name:'$service', text:'

for \nA

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

for B

'}]); + {name:'$service', text:'

for \nA

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

for B

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

for \nA

'); @@ -364,7 +378,7 @@ describe('ngdoc', function() { 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

'); + expect(doc.properties[0].description).toEqual('

desc rip tion

'); }); it('should parse @property with type and description both', function() { @@ -372,7 +386,7 @@ describe('ngdoc', function() { doc.parse(); expect(doc.properties[0].name).toEqual('name'); expect(doc.properties[0].type).toEqual('bool'); - expect(doc.properties[0].description).toEqual('

desc rip tion

'); + expect(doc.properties[0].description).toEqual('

desc rip tion

'); }); }); @@ -395,26 +409,26 @@ describe('ngdoc', function() { it('should parse @returns with type and description', function() { var doc = new Doc("@name a\n@returns {string} descrip tion"); doc.parse(); - expect(doc.returns).toEqual({type: 'string', description: '

descrip tion

'}); + expect(doc.returns).toEqual({type: 'string', description: '

descrip tion

'}); }); it('should parse @returns with complex type and description', function() { var doc = new Doc("@name a\n@returns {function(string, number=)} description"); doc.parse(); - expect(doc.returns).toEqual({type: 'function(string, number=)', description: '

description

'}); + expect(doc.returns).toEqual({type: 'function(string, number=)', description: '

description

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

descrip tion

'}); + expect(doc.returns).toEqual({type: 'string', description: '

descrip tion

'}); }); it('should support multiline content', function() { 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

'}); + toEqual({type: 'string', description: '

description\nnew line\nanother line

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

foo \n' + + toBe('

foo \n' + '

abc
\n\n' + '

bah

\n\n' + '

foo \n' + - '

cba
'); + '
cba
'); }); @@ -477,7 +491,7 @@ describe('ngdoc', function() { it('should not remove {{}}', function() { var doc = new Doc('@name a\n@example text {{ abc }}'); doc.parse(); - expect(doc.example).toEqual('

text {{ abc }}

'); + expect(doc.example).toEqual('

text {{ abc }}

'); }); }); @@ -496,10 +510,12 @@ describe('ngdoc', function() { doc.parse(); expect(doc.html()).toContain('

Method\'s this

\n' + '
' + + '
' + '

I am self.

' + + '
' + '
\n'); expect(doc.html()).toContain('

Method\'s this

\n' + - '

I am self.

'); + '

I am self.

'); }); }); -- cgit v1.2.3