From 43b2cd45f0b42efb67497a6471f3a1b26d792bd9 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Thu, 19 May 2011 16:48:05 +0200 Subject: Allow relative links in docs So you can use links without section when they link within the section. --- docs/spec/ngdocSpec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'docs/spec') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 090b20ab..cb11c1a5 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -104,6 +104,23 @@ describe('ngdoc', function(){ expect(doc.links).toContain('api/angular.link'); }); + describe('convertUrlToAbsolute', function() { + var doc; + + beforeEach(function() { + doc = new Doc({section: 'section'}); + }); + + it('should not change absolute url', function() { + expect(doc.convertUrlToAbsolute('guide/index')).toEqual('guide/index'); + }); + + it('should prepend current section to relative url', function() { + expect(doc.convertUrlToAbsolute('angular.widget')).toEqual('section/angular.widget'); + }); + + }); + describe('sorting', function(){ function property(name) { return function(obj) {return obj[name];}; @@ -366,7 +383,10 @@ describe('ngdoc', function(){ 'external{@link http://angularjs.org}\n\n' + 'external{@link ./static.html}\n\n' + '{@link angular.directive.ng:foo ng:foo}'); + + doc.section = 'api'; doc.parse(); + expect(doc.description). toContain('foo angular.foo'); expect(doc.description). -- cgit v1.2.3