diff options
| author | Misko Hevery | 2011-01-19 15:42:11 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-01-24 14:23:51 -0800 |
| commit | c2f2587a79aeb77aad66f081cf924a79348a698e (patch) | |
| tree | 8f5aa4cc6e7189befb834388b2102d1eda88a975 /docs/spec | |
| parent | 5d0d34ae72a9ca47f1b2dabda60711ad16ee9313 (diff) | |
| download | angular.js-c2f2587a79aeb77aad66f081cf924a79348a698e.tar.bz2 | |
fixed example rendering, add tests for it.
Diffstat (limited to 'docs/spec')
| -rw-r--r-- | docs/spec/domSpec.js | 24 | ||||
| -rw-r--r-- | docs/spec/ngdocSpec.js | 10 | ||||
| -rw-r--r-- | docs/spec/writerSpec.js | 8 |
3 files changed, 38 insertions, 4 deletions
diff --git a/docs/spec/domSpec.js b/docs/spec/domSpec.js new file mode 100644 index 00000000..af1a8faa --- /dev/null +++ b/docs/spec/domSpec.js @@ -0,0 +1,24 @@ +var DOM = require('dom.js').DOM; + +describe('dom', function(){ + describe('example', function(){ + it('should render code, live, test', function(){ + var dom = new DOM(); + dom.example('desc', 'src', 'scenario'); + expect(dom.toString()).toEqual('<h1>Example</h1>\ndesc<doc:example><doc:source>src</doc:source>\n<doc:scenario>scenario</doc:scenario>\n</doc:example>\n'); + }); + + it('should render non-live, test with description', function(){ + var dom = new DOM(); + dom.example('desc', 'src', false); + expect(dom.toString()).toEqual('<h1>Example</h1>\ndesc<div ng:non-bindable=""><pre class="brush: js; html-script: true;">src</pre>\n</div>\n'); + }); + + it('should render non-live, test', function(){ + var dom = new DOM(); + dom.example('desc', 'src', false); + expect(dom.toString()).toContain('<pre class="brush: js; html-script: true;">src</pre>'); + }); + + }); +}); diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 7d024cb5..2bea6e9a 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -279,6 +279,16 @@ describe('ngdoc', function(){ doc.parse(); expect(doc.html()).toContain('<p>some\n text'); }); + + it('should render description in related method', function(){ + var doc = new Doc(); + doc.ngdoc = 'service'; + doc.methods = [new Doc('@ngdoc method\n@exampleDescription MDesc\n@example MExmp').parse()]; + doc.properties = [new Doc('@ngdoc property\n@exampleDescription PDesc\n@example PExmp').parse()]; + expect(doc.html()).toContain('<p>MDesc</p><div ng:non-bindable=""><pre class="brush: js; html-script: true;">MExmp</pre>'); + expect(doc.html()).toContain('<p>PDesc</p><div ng:non-bindable=""><pre class="brush: js; html-script: true;">PExmp</pre>'); + }); + }); describe('@deprecated', function() { diff --git a/docs/spec/writerSpec.js b/docs/spec/writerSpec.js index 1a722ca6..8354ad5d 100644 --- a/docs/spec/writerSpec.js +++ b/docs/spec/writerSpec.js @@ -2,17 +2,17 @@ var writer = require('writer.js'); describe('writer', function(){ describe('toString', function(){ var toString = writer.toString; - + it('should merge string', function(){ expect(toString('abc')).toEqual('abc'); }); - + it('should merge obj', function(){ expect(toString({a:1})).toEqual('{"a":1}'); }); - + it('should merge array', function(){ expect(toString(['abc',{}])).toEqual('abc{}'); }); }); -});
\ No newline at end of file +}); |
