File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1
1
var ngdoc = require ( '../src/ngdoc.js' ) ;
2
2
var DOM = require ( '../src/dom.js' ) . DOM ;
3
+ var gruntUtil = require ( '../../lib/grunt/utils.js' ) ;
4
+
3
5
4
6
describe ( 'ngdoc' , function ( ) {
5
7
var Doc = ngdoc . Doc ;
@@ -287,6 +289,33 @@ describe('ngdoc', function() {
287
289
} ) ;
288
290
} ) ;
289
291
292
+
293
+ describe ( 'api section' , function ( ) {
294
+
295
+ it ( 'should render a "view source" button with link to the source in master' , function ( ) {
296
+ var doc = new Doc ( {
297
+ id : 'ng.abc' ,
298
+ name : 'ng.abc' ,
299
+ section : 'api' ,
300
+ ngdoc : 'service' ,
301
+ file : 'fooService.js' ,
302
+ line : '333'
303
+ } ) ;
304
+
305
+ if ( gruntUtil . getVersion ( ) . full . indexOf ( '-' ) === - 1 ) {
306
+ expect ( doc . html ( ) . match ( / ^ ( < a .* ?< \/ a > ) / ) [ 1 ] ) . toMatch (
307
+ / < a h r e f = " h t t p : \/ \/ g i t h u b \. c o m \/ a n g u l a r \/ a n g u l a r \. j s \/ t r e e \/ v \d + \. \d + \. \d + \/ f o o S e r v i c e \. j s # L 3 3 3 " c l a s s = " v i e w - s o u r c e /
308
+ ) ;
309
+ } else {
310
+ expect ( doc . html ( ) . match ( / ^ ( < a .* ?< \/ a > ) / ) [ 1 ] ) . toMatch (
311
+ / < a h r e f = " h t t p : \/ \/ g i t h u b \. c o m \/ a n g u l a r \/ a n g u l a r \. j s \/ t r e e \/ [ a - z 0 - 9 ] { 7 } \/ f o o S e r v i c e \. j s # L 3 3 3 " c l a s s = " v i e w - s o u r c e /
312
+ ) ;
313
+ }
314
+ } ) ;
315
+ } ) ;
316
+
317
+
318
+
290
319
////////////////////////////////////////
291
320
292
321
describe ( 'TAG' , function ( ) {
Original file line number Diff line number Diff line change @@ -552,7 +552,7 @@ Doc.prototype = {
552
552
minerrMsg ;
553
553
554
554
var gitTagFromFullVersion = function ( version ) {
555
- var match = version . match ( / - ( \w { 7 } ) / ) ;
555
+ var match = version . match ( / s h a \. ( \w { 7 } ) / ) ;
556
556
557
557
if ( match ) {
558
558
// git sha
You can’t perform that action at this time.
0 commit comments