diff options
| author | Misko Hevery | 2010-11-04 14:24:31 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-11-04 14:24:31 -0700 |
| commit | 47066e70e1621ff74bd2cd6b5853ca3c5841aba6 (patch) | |
| tree | 5a653300650aad0a4f1d8a88c0998edc7ebfe1fe /docs/spec | |
| parent | c0d30aedfca89fee2e1fc3b0b2fc1e7bfcb008b1 (diff) | |
| download | angular.js-47066e70e1621ff74bd2cd6b5853ca3c5841aba6.tar.bz2 | |
added documentation for ng:include and ng:widget and test for doc collector.
Diffstat (limited to 'docs/spec')
| -rw-r--r-- | docs/spec/collectSpec.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/docs/spec/collectSpec.js b/docs/spec/collectSpec.js new file mode 100644 index 00000000..2d1b559c --- /dev/null +++ b/docs/spec/collectSpec.js @@ -0,0 +1,47 @@ +console.log(__dirname); +require.paths.push(__dirname + "/../"); +require.paths.push(__dirname + "/../../"); +var fs = require('fs'); +var Script = process.binding('evals').Script; +var collect = load('docs/collect.js'); + +describe('collect', function(){ + describe('TAG', function(){ + var TAG = collect.TAG; + describe('@param', function(){ + var doc; + beforeEach(function(){ + doc = {}; + }); + it('should parse with no default', function(){ + TAG.param(doc, 'param', + '{(number|string)} number Number to format.'); + expect(doc.param).toEqual([{ + type : '(number|string)', + name : 'number', + 'default' : undefined, + description : 'Number to format.' }]); + }); + it('should parse with default', function(){ + TAG.param(doc, 'param', + '{(number|string)=} [fractionSize=2] desc'); + expect(doc.param).toEqual([{ + type : '(number|string)', + name : 'fractionSize', + 'default' : '2', + description : 'desc' }]); + }); + }); + }); +}); + +function load(path){ + var sandbox = { + require: require, + console: console, + __dirname: __dirname, + testmode: true + }; + Script.runInNewContext(fs.readFileSync(path), sandbox, path); + return sandbox; +} |
