diff options
| -rw-r--r-- | docs/spec/ngdocSpec.js | 14 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 144b3376..95e86d99 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -215,13 +215,13 @@ describe('ngdoc', function(){ expect(doc.properties.length).toEqual(2); }); - it('should parse @property with only name', function() { + it('should not parse @property without a type', function() { var doc = new Doc("@property fake"); - doc.parse(); - expect(doc.properties[0].name).toEqual('fake'); + expect(function() { doc.parse(); }). + toThrow(new Error("Not a valid 'property' format: fake")); }); - it('should parse @property with optional type', function() { + it('should parse @property with type', function() { var doc = new Doc("@property {string} name"); doc.parse(); expect(doc.properties[0].name).toEqual('name'); @@ -229,10 +229,10 @@ describe('ngdoc', function(){ }); it('should parse @property with optional description', function() { - var doc = new Doc("@property name desc rip tion"); + var doc = new Doc("@property {string} name desc rip tion"); doc.parse(); expect(doc.properties[0].name).toEqual('name'); - expect(doc.properties[0].description).toEqual('desc rip tion'); + expect(doc.properties[0].description).toEqual('<p>desc rip tion</p>'); }); it('should parse @property with type and description both', function() { @@ -240,7 +240,7 @@ describe('ngdoc', function(){ doc.parse(); expect(doc.properties[0].name).toEqual('name'); expect(doc.properties[0].type).toEqual('bool'); - expect(doc.properties[0].description).toEqual('desc rip tion'); + expect(doc.properties[0].description).toEqual('<p>desc rip tion</p>'); }); }); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 18ea523b..153e6f90 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -157,14 +157,14 @@ Doc.prototype = { } else if(atName == 'requires') { self.requires.push(text); } else if(atName == 'property') { - var match = text.match(/^({(\S+)}\s*)?(\S+)(\s+(.*))?/); + var match = text.match(/^{(\S+)}\s+(\S+)(\s+(.*))?/); if (!match) { throw new Error("Not a valid 'property' format: " + text); } var property = { - type: match[2], - name: match[3], - description: match[5] || '' + type: match[1], + name: match[2], + description: self.markdown(text.replace(match[0], match[4])) }; self.properties.push(property); } else { @@ -445,7 +445,7 @@ Doc.prototype = { }); dom.h('Properties', this.properties, function(property){ dom.h(property.name, function(){ - dom.text(property.description); + dom.html(property.description); dom.h('Example', property.example, dom.html); }); }); |
