mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-21 04:41:51 +00:00
adding support for @param.optional
This commit is contained in:
parent
9d36368ff9
commit
ee0e9a4452
2 changed files with 6 additions and 3 deletions
|
|
@ -252,6 +252,7 @@ var TAG = {
|
||||||
var param = {
|
var param = {
|
||||||
type: match[2],
|
type: match[2],
|
||||||
name: match[6] || match[5],
|
name: match[6] || match[5],
|
||||||
|
optional: !!match[3],
|
||||||
'default':match[7],
|
'default':match[7],
|
||||||
description:markdownNoP(value.replace(match[0], match[8]))
|
description:markdownNoP(value.replace(match[0], match[8]))
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -83,16 +83,18 @@ describe('collect', function(){
|
||||||
'{(number|string)} number Number \n to format.');
|
'{(number|string)} number Number \n to format.');
|
||||||
expect(doc.param).toEqual([{
|
expect(doc.param).toEqual([{
|
||||||
type : '(number|string)',
|
type : '(number|string)',
|
||||||
name : 'number',
|
name : 'number',
|
||||||
|
optional: false,
|
||||||
'default' : undefined,
|
'default' : undefined,
|
||||||
description : 'Number \n to format.' }]);
|
description : 'Number \n to format.' }]);
|
||||||
});
|
});
|
||||||
it('should parse with default', function(){
|
it('should parse with default and optional', function(){
|
||||||
TAG.param(doc, 'param',
|
TAG.param(doc, 'param',
|
||||||
'{(number|string)=} [fractionSize=2] desc');
|
'{(number|string)=} [fractionSize=2] desc');
|
||||||
expect(doc.param).toEqual([{
|
expect(doc.param).toEqual([{
|
||||||
type : '(number|string)',
|
type : '(number|string)',
|
||||||
name : 'fractionSize',
|
name : 'fractionSize',
|
||||||
|
optional: true,
|
||||||
'default' : '2',
|
'default' : '2',
|
||||||
description : 'desc' }]);
|
description : 'desc' }]);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue