diff options
| author | Vojta Jina | 2011-05-19 16:48:05 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-06-06 22:52:01 -0700 |
| commit | 43b2cd45f0b42efb67497a6471f3a1b26d792bd9 (patch) | |
| tree | 4c51a94684a7f4906113d5a260e8cd1a713b1980 /docs/spec/ngdocSpec.js | |
| parent | e389911a35a4838ddba4f22f962c484c42f1017f (diff) | |
| download | angular.js-43b2cd45f0b42efb67497a6471f3a1b26d792bd9.tar.bz2 | |
Allow relative links in docs
So you can use links without section when they link within the section.
Diffstat (limited to 'docs/spec/ngdocSpec.js')
| -rw-r--r-- | docs/spec/ngdocSpec.js | 20 |
1 files changed, 20 insertions, 0 deletions
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 <a href="#!api/angular.foo"><code>angular.foo</code></a>'); expect(doc.description). |
