@@ -59,10 +59,10 @@ describe('ngdoc', function() {
59
59
'@param {function(number, string=)} d fn with optional arguments' ) ;
60
60
doc . parse ( ) ;
61
61
expect ( doc . param ) . toEqual ( [
62
- { name :'a' , description :'<div class="a-page"><p>short</p></div>' , type :'*' , optional :false , 'default' :undefined } ,
63
- { name :'b' , description :'<div class="a-page"><p>med</p></div>' , type :'Type' , optional :false , 'default' :undefined } ,
64
- { name :'c' , description :'<div class="a-page"><p>long\nline</p></div>' , type :'Class' , optional :true , 'default' :'2' } ,
65
- { name :'d' , description :'<div class="a-page"><p>fn with optional arguments</p></div>' ,
62
+ { name :'a' , description :'<div class="a-page"><p>short</p>\n </div>' , type :'*' , optional :false , 'default' :undefined } ,
63
+ { name :'b' , description :'<div class="a-page"><p>med</p>\n </div>' , type :'Type' , optional :false , 'default' :undefined } ,
64
+ { name :'c' , description :'<div class="a-page"><p>long\nline</p>\n </div>' , type :'Class' , optional :true , 'default' :'2' } ,
65
+ { name :'d' , description :'<div class="a-page"><p>fn with optional arguments</p>\n </div>' ,
66
66
type : 'function(number, string=)' , optional : false , 'default' :undefined }
67
67
] ) ;
68
68
} ) ;
@@ -72,7 +72,7 @@ describe('ngdoc', function() {
72
72
doc . parse ( ) ;
73
73
expect ( doc . returns ) . toEqual ( {
74
74
type : 'Type' ,
75
- description : '<div class="a-page"><p>text <em>bold</em>.</p></div>'
75
+ description : '<div class="a-page"><p>text <em>bold</em>.</p>\n </div>'
76
76
} ) ;
77
77
} ) ;
78
78
@@ -142,26 +142,26 @@ describe('ngdoc', function() {
142
142
'<pre class="prettyprint linenums">\n' +
143
143
'<b>angular</b>.k\n' +
144
144
'</pre>\n' +
145
- ' asdf x</p></div>' ) ;
145
+ ' asdf x</p>\n </div>' ) ;
146
146
} ) ;
147
147
148
148
it ( 'should wrap everything inside a container tag' , function ( ) {
149
149
var doc = new Doc ( '@name superman' ) . parse ( ) ;
150
150
var content = doc . markdown ( 'hello' ) ;
151
151
152
- expect ( content ) . toMatch ( '<div class="superman-page"><p>hello</p></div>' ) ;
152
+ expect ( content ) . toMatch ( '<div class="superman-page"><p>hello</p>\n </div>' ) ;
153
153
} ) ;
154
154
155
155
it ( 'should use the content before a colon as the name prefix for the className of the tag container' , function ( ) {
156
156
var doc = new Doc ( '@name super: man' ) . parse ( ) ;
157
157
var content = doc . markdown ( 'hello' ) ;
158
158
159
- expect ( content ) . toMatch ( '<div class="super-page super-man-page"><p>hello</p></div>' ) ;
159
+ expect ( content ) . toMatch ( '<div class="super-page super-man-page"><p>hello</p>\n </div>' ) ;
160
160
} ) ;
161
161
162
162
it ( 'should replace text between two <pre></pre> tags' , function ( ) {
163
163
expect ( new Doc ( ) . markdown ( '<pre>x</pre>\n# One\n<pre>b</pre>' ) ) .
164
- toMatch ( '</pre>\n\n <h1 id="one" >One</h1>\n \n<pre' ) ;
164
+ toMatch ( '</pre>\n<h1>One</h1>\n<pre' ) ;
165
165
} ) ;
166
166
167
167
it ( 'should replace inline variable type hints' , function ( ) {
@@ -171,16 +171,16 @@ describe('ngdoc', function() {
171
171
172
172
it ( 'should ignore nested doc widgets' , function ( ) {
173
173
expect ( new Doc ( ) . markdown (
174
- 'before<div class="tabbable">\n' +
174
+ 'before\n <div class="tabbable">\n' +
175
175
'<div class="tab-pane well" id="git-mac" ng:model="Git on Mac/Linux">' +
176
- '\ngit bla bla\n</doc:tutorial-instruction >\n' +
177
- '</doc:tutorial-instructions >' ) ) . toEqual (
176
+ '\ngit bla bla\n</div >\n' +
177
+ '</div >' ) ) . toEqual (
178
178
179
- '<div class="docs-page"><p>before<div class="tabbable">\n' +
179
+ '<div class="docs-page"><p>before</p>\n< div class="tabbable">\n' +
180
180
'<div class="tab-pane well" id="git-mac" ng:model="Git on Mac/Linux">\n' +
181
181
'git bla bla\n' +
182
- '</doc:tutorial-instruction >\n' +
183
- '</doc:tutorial-instructions></p ></div>' ) ;
182
+ '</div >\n' +
183
+ '</div ></div>' ) ;
184
184
} ) ;
185
185
186
186
it ( 'should unindent text before processing based on the second line' , function ( ) {
@@ -190,10 +190,10 @@ describe('ngdoc', function() {
190
190
' fourth line\n\n' +
191
191
' fifth line' ) ) .
192
192
toMatch ( '<p>first line\n' +
193
- 'second line</p>\n\n ' +
193
+ 'second line</p>\n' +
194
194
'<pre><code>third line\n' +
195
- ' fourth line\n </code></pre>\n \n' +
196
- '<p>fifth line</p>' ) ;
195
+ ' fourth line</code></pre>\n' +
196
+ '<p>fifth line</p>\n ' ) ;
197
197
} ) ;
198
198
199
199
it ( 'should unindent text before processing based on the first line' , function ( ) {
@@ -202,11 +202,11 @@ describe('ngdoc', function() {
202
202
' third line\n' +
203
203
' fourth line\n\n' +
204
204
' fifth line' ) ) .
205
- toMatch ( '<p>first line</p>\n \n' +
205
+ toMatch ( '<div class="docs-page">< p>first line</p>\n' +
206
206
'<pre><code>second line\n' +
207
207
'third line\n' +
208
- ' fourth line\n </code></pre>\n \n' +
209
- '<p>fifth line</p>' ) ;
208
+ ' fourth line</code></pre>\n' +
209
+ '<p>fifth line</p>\n</div> ' ) ;
210
210
} ) ;
211
211
212
212
@@ -304,7 +304,7 @@ describe('ngdoc', function() {
304
304
name : 'number' ,
305
305
optional : false ,
306
306
'default' : undefined ,
307
- description : '<div class="a-page"><p>Number \nto format.</p></div>' } ] ) ;
307
+ description : '<div class="a-page"><p>Number \nto format.</p>\n </div>' } ] ) ;
308
308
} ) ;
309
309
310
310
it ( 'should parse with default and optional' , function ( ) {
@@ -315,7 +315,7 @@ describe('ngdoc', function() {
315
315
name : 'fractionSize' ,
316
316
optional : true ,
317
317
'default' : '2' ,
318
- description : '<div class="a-page"><p>desc</p></div>' } ] ) ;
318
+ description : '<div class="a-page"><p>desc</p>\n </div>' } ] ) ;
319
319
} ) ;
320
320
} ) ;
321
321
@@ -325,8 +325,8 @@ describe('ngdoc', function() {
325
325
doc . ngdoc = 'service' ;
326
326
doc . parse ( ) ;
327
327
expect ( doc . requires ) . toEqual ( [
328
- { name :'$service' , text :'<div class="a-page"><p>for \n<code>A</code></p></div>' } ,
329
- { name :'$another' , text :'<div class="a-page"><p>for <code>B</code></p></div>' } ] ) ;
328
+ { name :'$service' , text :'<div class="a-page"><p>for \n<code>A</code></p>\n </div>' } ,
329
+ { name :'$another' , text :'<div class="a-page"><p>for <code>B</code></p>\n </div>' } ] ) ;
330
330
expect ( doc . html ( ) ) . toContain ( '<a href="api/ng.$service">$service</a>' ) ;
331
331
expect ( doc . html ( ) ) . toContain ( '<a href="api/ng.$another">$another</a>' ) ;
332
332
expect ( doc . html ( ) ) . toContain ( '<p>for \n<code>A</code></p>' ) ;
@@ -378,15 +378,15 @@ describe('ngdoc', function() {
378
378
var doc = new Doc ( "@name a\n@property {string} name desc rip tion" ) ;
379
379
doc . parse ( ) ;
380
380
expect ( doc . properties [ 0 ] . name ) . toEqual ( 'name' ) ;
381
- expect ( doc . properties [ 0 ] . description ) . toEqual ( '<div class="a-page"><p>desc rip tion</p></div>' ) ;
381
+ expect ( doc . properties [ 0 ] . description ) . toEqual ( '<div class="a-page"><p>desc rip tion</p>\n </div>' ) ;
382
382
} ) ;
383
383
384
384
it ( 'should parse @property with type and description both' , function ( ) {
385
385
var doc = new Doc ( "@name a\n@property {bool} name desc rip tion" ) ;
386
386
doc . parse ( ) ;
387
387
expect ( doc . properties [ 0 ] . name ) . toEqual ( 'name' ) ;
388
388
expect ( doc . properties [ 0 ] . type ) . toEqual ( 'bool' ) ;
389
- expect ( doc . properties [ 0 ] . description ) . toEqual ( '<div class="a-page"><p>desc rip tion</p></div>' ) ;
389
+ expect ( doc . properties [ 0 ] . description ) . toEqual ( '<div class="a-page"><p>desc rip tion</p>\n </div>' ) ;
390
390
} ) ;
391
391
392
392
} ) ;
@@ -409,26 +409,26 @@ describe('ngdoc', function() {
409
409
it ( 'should parse @returns with type and description' , function ( ) {
410
410
var doc = new Doc ( "@name a\n@returns {string} descrip tion" ) ;
411
411
doc . parse ( ) ;
412
- expect ( doc . returns ) . toEqual ( { type : 'string' , description : '<div class="a-page"><p>descrip tion</p></div>' } ) ;
412
+ expect ( doc . returns ) . toEqual ( { type : 'string' , description : '<div class="a-page"><p>descrip tion</p>\n </div>' } ) ;
413
413
} ) ;
414
414
415
415
it ( 'should parse @returns with complex type and description' , function ( ) {
416
416
var doc = new Doc ( "@name a\n@returns {function(string, number=)} description" ) ;
417
417
doc . parse ( ) ;
418
- expect ( doc . returns ) . toEqual ( { type : 'function(string, number=)' , description : '<div class="a-page"><p>description</p></div>' } ) ;
418
+ expect ( doc . returns ) . toEqual ( { type : 'function(string, number=)' , description : '<div class="a-page"><p>description</p>\n </div>' } ) ;
419
419
} ) ;
420
420
421
421
it ( 'should transform description of @returns with markdown' , function ( ) {
422
422
var doc = new Doc ( "@name a\n@returns {string} descrip *tion*" ) ;
423
423
doc . parse ( ) ;
424
- expect ( doc . returns ) . toEqual ( { type : 'string' , description : '<div class="a-page"><p>descrip <em>tion</em></p></div>' } ) ;
424
+ expect ( doc . returns ) . toEqual ( { type : 'string' , description : '<div class="a-page"><p>descrip <em>tion</em></p>\n </div>' } ) ;
425
425
} ) ;
426
426
427
427
it ( 'should support multiline content' , function ( ) {
428
428
var doc = new Doc ( "@name a\n@returns {string} description\n new line\n another line" ) ;
429
429
doc . parse ( ) ;
430
430
expect ( doc . returns ) .
431
- toEqual ( { type : 'string' , description : '<div class="a-page"><p>description\nnew line\nanother line</p></div>' } ) ;
431
+ toEqual ( { type : 'string' , description : '<div class="a-page"><p>description\nnew line\nanother line</p>\n </div>' } ) ;
432
432
} ) ;
433
433
} ) ;
434
434
@@ -437,19 +437,18 @@ describe('ngdoc', function() {
437
437
var doc = new Doc ( "@name a\n@description <pre><b>abc</b></pre>" ) ;
438
438
doc . parse ( ) ;
439
439
expect ( doc . description ) .
440
- toBe ( '<div class="a-page"><pre class="prettyprint linenums"><b>abc</b></pre></div>' ) ;
440
+ toBe ( '<div class="a-page"><pre class="prettyprint linenums"><b>abc</b></pre>\n </div>' ) ;
441
441
} ) ;
442
442
443
443
it ( 'should support multiple pre blocks' , function ( ) {
444
444
var doc = new Doc ( "@name a\n@description foo \n<pre>abc</pre>\n#bah\nfoo \n<pre>cba</pre>" ) ;
445
445
doc . parse ( ) ;
446
446
expect ( doc . description ) .
447
447
toBe ( '<div class="a-page"><p>foo \n' +
448
- '<pre class="prettyprint linenums">abc</pre>\n\n ' +
449
- '<h1 id="bah" >bah</h1>\n \n' +
448
+ '<pre class="prettyprint linenums">abc</pre>\n' +
449
+ '<h1>bah</h1>\n' +
450
450
'<p>foo \n' +
451
- '<pre class="prettyprint linenums">cba</pre></div>' ) ;
452
-
451
+ '<pre class="prettyprint linenums">cba</pre>\n</div>' ) ;
453
452
} ) ;
454
453
455
454
it ( 'should support nested @link annotations with or without description' , function ( ) {
@@ -491,7 +490,7 @@ describe('ngdoc', function() {
491
490
it ( 'should not remove {{}}' , function ( ) {
492
491
var doc = new Doc ( '@name a\n@example text {{ abc }}' ) ;
493
492
doc . parse ( ) ;
494
- expect ( doc . example ) . toEqual ( '<div class="a-page"><p>text {{ abc }}</p></div>' ) ;
493
+ expect ( doc . example ) . toEqual ( '<div class="a-page"><p>text {{ abc }}</p>\n </div>' ) ;
495
494
} ) ;
496
495
} ) ;
497
496
@@ -511,11 +510,11 @@ describe('ngdoc', function() {
511
510
expect ( doc . html ( ) ) . toContain ( '<h3>Method\'s <code>this</code></h3>\n' +
512
511
'<div>' +
513
512
'<div class="a-page">' +
514
- '<p>I am self.</p>' +
513
+ '<p>I am self.</p>\n ' +
515
514
'</div>' +
516
515
'</div>\n' ) ;
517
516
expect ( doc . html ( ) ) . toContain ( '<h3>Method\'s <code>this</code></h3>\n' +
518
- '<div><div class="a-page"><p>I am self.</p></div></div>' ) ;
517
+ '<div><div class="a-page"><p>I am self.</p>\n </div></div>' ) ;
519
518
} ) ;
520
519
} ) ;
521
520
@@ -542,7 +541,7 @@ describe('ngdoc', function() {
542
541
var doc = new Doc ( '@ngdoc overview\n@name angular\n@description\n#heading\ntext' ) ;
543
542
doc . parse ( ) ;
544
543
expect ( doc . html ( ) ) . toContain ( 'text' ) ;
545
- expect ( doc . html ( ) ) . toContain ( '<h2 id="heading" >heading</h2>' ) ;
544
+ expect ( doc . html ( ) ) . toContain ( '<h2>heading</h2>' ) ;
546
545
expect ( doc . html ( ) ) . not . toContain ( 'Description' ) ;
547
546
} ) ;
548
547
} ) ;
0 commit comments