From 050e5d773fa7eca46d72afd26cbd5d5bf1af3ff6 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 18 Jan 2011 15:32:46 -0800 Subject: verify that issue# 162 was fixed with doc rewrite --- docs/spec/ngdocSpec.js | 89 +++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 41 deletions(-) (limited to 'docs') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 63981e90..cf469063 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -5,13 +5,13 @@ describe('ngdoc', function(){ var Doc = ngdoc.Doc; describe('Doc', function(){ describe('metadata', function(){ - + it('should find keywords', function(){ expect(new Doc('\nHello: World! @ignore.').keywords()).toEqual('hello world'); expect(new Doc('The `ng:class-odd` and').keywords()).toEqual('and ng:class-odd the'); }); }); - + describe('parse', function(){ it('should convert @names into properties', function(){ var doc = new Doc('\n@name name\n@desc\ndesc\ndesc2\n@dep\n'); @@ -20,7 +20,7 @@ describe('ngdoc', function(){ expect(doc.desc).toEqual('desc\ndesc2'); expect(doc.dep).toEqual(''); }); - + it('should parse parameters', function(){ var doc = new Doc( '@param {*} a short\n' + @@ -33,7 +33,7 @@ describe('ngdoc', function(){ {name:'c', description:'long\nline', type:'Class', optional:true, 'default':'2'} ]); }); - + it('should parse return', function(){ var doc = new Doc('@returns {Type} text *bold*.'); doc.parse(); @@ -42,29 +42,36 @@ describe('ngdoc', function(){ description: 'text bold.' }); }); + + it('should not remove extra line breaks', function(){ + var doc = new Doc('@example\nA\n\nB'); + doc.parse(); + expect(doc.example).toEqual('A\n\nB'); + }); + }); - - + + }); - + describe('markdown', function(){ var markdown = ngdoc.markdown; - + it('should replace angular in markdown', function(){ expect(markdown('')). toEqual('

<angular/>

'); }); - + it('should not replace anything in
', function(){
       expect(markdown('bah x\n
\nangular.k\n
\n asdf x')). toEqual( '

bah x

' + - '
\n' + 
-            'angular.k\n' + 
-            '
' + + '
\n' +
+            'angular.k\n' +
+            '
' + '

asdf x

'); }); - + it('should replace text between two
 tags', function() {
       expect(markdown('
x
# One
b
')). toMatch('

One

abc
"); @@ -254,20 +261,20 @@ describe('ngdoc', function(){ }); }); }); - + describe('usage', function(){ var dom; - + beforeEach(function(){ dom = new DOM(); this.addMatchers({ - toContain: function(text) { + toContain: function(text) { this.actual = this.actual.toString(); - return this.actual.indexOf(text) > -1; + return this.actual.indexOf(text) > -1; } }); }); - + describe('filter', function(){ it('should format', function(){ var doc = new Doc({ @@ -283,7 +290,7 @@ describe('ngdoc', function(){ expect(dom).toContain('angular.filter.myFilter(a, b)'); }); }); - + describe('validator', function(){ it('should format', function(){ var doc = new Doc({ @@ -299,7 +306,7 @@ describe('ngdoc', function(){ expect(dom).toContain('angular.validator.myValidator(a, b)'); }); }); - + describe('formatter', function(){ it('should format', function(){ var doc = new Doc({ -- cgit v1.2.3