From 0b6f1ce5f89f47f9302ff1e8cd8f4b92f837c413 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 20 Mar 2013 16:24:23 -0700 Subject: feat(ngAnimate): add support for animation --- docs/spec/ngdocSpec.js | 16 +++++++++++++++ docs/src/dom.js | 4 +++- docs/src/ngdoc.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 48db580b..b1bbbd61 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -475,6 +475,22 @@ describe('ngdoc', function() { '

I am self.

'); }); }); + + describe('@animations', function() { + it('should render @this', function() { + var doc = new Doc('@name a\n@animations\nenter - Add text\nleave - Remove text\n'); + doc.ngdoc = 'filter'; + doc.parse(); + expect(doc.html()).toContain( + '

Animations

\n' + + '
' + + '' + + '
'); + }); + }); }); describe('usage', function() { diff --git a/docs/src/dom.js b/docs/src/dom.js index 2c276297..1bb9578e 100644 --- a/docs/src/dom.js +++ b/docs/src/dom.js @@ -89,7 +89,9 @@ DOM.prototype = { replace(/-+/gm, '-'). replace(/-*$/gm, ''); anchor = {'id': id}; - className = {'class': id.toLowerCase().replace(/[._]/mg, '-')}; + var classNameValue = id.toLowerCase().replace(/[._]/mg, '-'); + if(classNameValue == 'hide') classNameValue = ''; + className = {'class': classNameValue}; } this.tag('h' + this.headingDepth, anchor, heading); if (content instanceof Array) { diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index f8f6cdf5..2a96abd9 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -328,6 +328,18 @@ Doc.prototype = { }); dom.html(param.description); }); + if(this.animations) { + dom.h('Animations', this.animations, function(animations){ + dom.html(''); + }); + } }, html_usage_returns: function(dom) { @@ -433,6 +445,48 @@ Doc.prototype = { dom.text(''); }); } + if(self.animations) { + var animations = [], matches = self.animations.split("\n"); + matches.forEach(function(ani) { + var name = ani.match(/^\s*(.+?)\s*-/)[1]; + animations.push(name); + }); + + dom.html('with animations'); + var comment; + if(animations.length == 1) { + comment = 'The ' + animations[0] + ' animation is supported'; + } + else { + var rhs = animations[animations.length-1]; + var lhs = ''; + for(var i=0;i0) { + lhs += ', '; + } + lhs += animations[i]; + } + comment = 'The ' + lhs + ' and ' + rhs + ' animations are supported'; + } + var element = self.element || 'ANY'; + dom.code(function() { + dom.text('//' + comment + "\n"); + dom.text('<' + element + ' '); + dom.text(dashCase(self.shortName)); + renderParams('\n ', '="', '"', true); + dom.text(' ng-animate="{'); + animations.forEach(function(ani, index) { + if (index) { + dom.text(', '); + } + dom.text(ani + ': \'' + ani + '-animation\''); + }); + dom.text('}">\n ...\n'); + dom.text(''); + }); + + dom.html('Click here to learn more about the steps involved in the animation.'); + } } self.html_usage_directiveInfo(dom); self.html_usage_parameters(dom); -- cgit v1.2.3