From ba6b68b6ae2bb2400a75ca2834fee47bfd60f1c6 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 31 Jan 2011 16:21:29 -0800 Subject: changed the documentation @example to use --- docs/spec/domSpec.js | 28 -------------------- docs/spec/ngdocSpec.js | 70 ++++++++++---------------------------------------- 2 files changed, 14 insertions(+), 84 deletions(-) (limited to 'docs/spec') diff --git a/docs/spec/domSpec.js b/docs/spec/domSpec.js index f9308ed6..3fda656f 100644 --- a/docs/spec/domSpec.js +++ b/docs/spec/domSpec.js @@ -7,34 +7,6 @@ describe('dom', function(){ dom = new DOM(); }); - describe('example', function(){ - it('should render code, live, test', function(){ - dom.example('desc', 'src', 'scenario'); - expect(dom.toString()).toEqual( - '

Example

\n' + - '
' + - 'descsrc\n' + - 'scenario\n'+ - '\n' + - '
\n'); - }); - - it('should render non-live, test with description', function(){ - dom.example('desc', 'src', false); - expect(dom.toString()).toEqual('

Example

\n' + - '
' + - 'desc
' + - '
src
\n' + - '
\n' + - '
\n'); - }); - - it('should render non-live, test', function(){ - dom.example('desc', 'src', false); - expect(dom.toString()).toContain('
src
'); - }); - }); - describe('h', function(){ it('should render using function', function(){ diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index d912bf3a..69bb5db3 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -74,12 +74,6 @@ describe('ngdoc', function(){ }); }); - it('should not remove extra line breaks', function(){ - var doc = new Doc('@example\nA\n\nB'); - doc.parse(); - expect(doc.example).toEqual('A\n\nB'); - }); - it('should parse filename', function(){ var doc = new Doc('@name friendly name', 'docs/a.b.ngdoc', 1); doc.parse(0); @@ -128,32 +122,14 @@ describe('ngdoc', function(){ }); }); - describe('scenario', function(){ - it('should render from @example/@scenario and ', function(){ - var doc = new Doc( - '@id id\n' + - '@description scenario0' + - '@example exempleText\n' + - '@scenario scenario1\n' + - '@scenario scenario2').parse(); - expect(ngdoc.scenarios([doc])).toContain('describe("id"'); - expect(ngdoc.scenarios([doc])).toContain('navigateTo("index.html#!id")'); - expect(ngdoc.scenarios([doc])).toContain('\n scenario0\n'); - expect(ngdoc.scenarios([doc])).toContain('\n scenario1\n'); - expect(ngdoc.scenarios([doc])).toContain('\n scenario2\n'); - }); - }); - describe('markdown', function(){ - var markdown = ngdoc.markdown; - it('should replace angular in markdown', function(){ - expect(markdown('')). + expect(new Doc().markdown('')). toEqual('

<angular/>

'); }); it('should not replace anything in
, but escape the html escape the content', function(){
-      expect(markdown('bah x\n
\nangular.k\n
\n asdf x')). + expect(new Doc().markdown('bah x\n
\nangular.k\n
\n asdf x')). toEqual( '

bah x

' + '
\n' +
@@ -163,7 +139,7 @@ describe('ngdoc', function(){
     });
 
     it('should replace text between two 
 tags', function() {
-      expect(markdown('
x
# One
b
')). + expect(new Doc().markdown('
x
# One
b
')). toMatch('

One

text {{ abc }}

'); }); - }); - describe('@exampleDescription', function(){ - it('should render example description', function(){ - var doc = new Doc('@exampleDescription some\n text'); - doc.ngdoc = "filter"; - doc.parse(); - expect(doc.html()).toContain('

some\n text'); - }); - - it('should alias @exampleDescription to @exampleDesc', function(){ - var doc = new Doc('@exampleDesc some\n text'); - doc.ngdoc = "filter"; - doc.parse(); - expect(doc.html()).toContain('

some\n text'); + it('should support doc:example', function(){ + var doc = new Doc('@ngdoc overview\n@example \n' + + '\n' + + ' \n' + + ' \n' + + '').parse(); + var html = doc.html(); + expect(html).toContain('<escapeme>'); + expect(html).toContain('<scenario>'); + expect(doc.scenarios).toEqual(['']); }); - - it('should render description in related method', function(){ - var doc = new Doc('').parse(); - 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('

MDesc

' + - '
MExmp
'); - expect(doc.html()).toContain('

PDesc

' + - '
PExmp
'); - }); - }); describe('@depricated', function() { -- cgit v1.2.3