mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
docs(scope): show which directives create scopes
This commit is contained in:
@@ -349,6 +349,26 @@ describe('ngdoc', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('@scope', function() {
|
||||
it('should state the new scope will be created', function() {
|
||||
var doc = new Doc('@name a\n@scope');
|
||||
doc.ngdoc = 'directive';
|
||||
doc.parse();
|
||||
expect(doc.scope).toEqual('');
|
||||
expect(doc.html()).toContain('This directive creates new scope.');
|
||||
});
|
||||
});
|
||||
|
||||
describe('@priority', function() {
|
||||
it('should state the priority', function() {
|
||||
var doc = new Doc('@name a\n@priority 123');
|
||||
doc.ngdoc = 'directive';
|
||||
doc.parse();
|
||||
expect(doc.priority).toEqual('123');
|
||||
expect(doc.html()).toContain('This directive executes at priority level 123.');
|
||||
});
|
||||
});
|
||||
|
||||
describe('@property', function() {
|
||||
it('should parse @property tags into array', function() {
|
||||
var doc = new Doc("@name a\n@property {type} name1 desc\n@property {type} name2 desc");
|
||||
|
||||
@@ -374,6 +374,7 @@ Doc.prototype = {
|
||||
dom.text('>\n ...\n');
|
||||
dom.text('</' + self.element + '>');
|
||||
});
|
||||
self.html_usage_directiveInfo(dom);
|
||||
self.html_usage_parameters(dom);
|
||||
});
|
||||
},
|
||||
@@ -461,11 +462,25 @@ Doc.prototype = {
|
||||
});
|
||||
});
|
||||
|
||||
self.html_usage_directiveInfo(dom);
|
||||
self.html_usage_parameters(dom);
|
||||
self.html_usage_returns(dom);
|
||||
});
|
||||
},
|
||||
|
||||
html_usage_directiveInfo: function(dom) {
|
||||
var self = this;
|
||||
var list = [];
|
||||
|
||||
|
||||
if (self.scope !== undefined) {
|
||||
list.push('This directive creates new scope.');
|
||||
}
|
||||
if (self.priority !== undefined) {
|
||||
list.push('This directive executes at priority level ' + self.priority + '.');
|
||||
}
|
||||
dom.ul(list);
|
||||
},
|
||||
|
||||
html_usage_overview: function(dom){
|
||||
dom.html(this.description);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user