mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
added @listens tag (need to add to template too)
This commit is contained in:
parent
21dbd5804f
commit
5ffaaff619
@ -405,6 +405,15 @@ exports.defineTags = function(dictionary) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dictionary.defineTag('listens', {
|
||||||
|
mustHaveValue: true,
|
||||||
|
onTagged: function (doclet, tag) {
|
||||||
|
if (!doclet.listens) { doclet.listens = []; }
|
||||||
|
doclet.listens.push(tag.value);
|
||||||
|
// TODO: verify that parameters match the event parameters?
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
dictionary.defineTag('member', {
|
dictionary.defineTag('member', {
|
||||||
canHaveType: true,
|
canHaveType: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
|
|||||||
11
test/specs/tags/listenstag.js
Normal file
11
test/specs/tags/listenstag.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
describe("@listens tag", function() {
|
||||||
|
var doclet = require('jsdoc/doclet'),
|
||||||
|
doc = new doclet.Doclet('/** An event handler\n@function handler\n@listens Foo\n@listens Bar */', {});
|
||||||
|
|
||||||
|
it("should create a 'listens' property on the doclet, an array, with the events that are listened to", function() {
|
||||||
|
expect(Array.isArray(doc.listens)).toBeTruthy();
|
||||||
|
expect(doc.listens.length).toBe(2);
|
||||||
|
expect(doc.listens).toContain('Foo');
|
||||||
|
expect(doc.listens).toContain('Bar');
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user