mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
modified @listens test fixture so I can use it for addEventListeners too
This commit is contained in:
parent
a789bc3187
commit
17a69c727f
37
test/fixtures/listenstag.js
vendored
37
test/fixtures/listenstag.js
vendored
@ -1,7 +1,34 @@
|
||||
/** An event handler.
|
||||
* @function
|
||||
* @listens Foo
|
||||
* @listens Bar
|
||||
/** @module myModule */
|
||||
|
||||
/** An event (has listeners).
|
||||
* @event MyEvent
|
||||
* @memberof module:myModule
|
||||
* @param {number} foo - asdf. */
|
||||
|
||||
/** A handler.
|
||||
* @listens module:myModule.MyEvent
|
||||
* @listens module:myModule~Events.event:Event2
|
||||
* @listens fakeEvent
|
||||
*/
|
||||
function handler () {
|
||||
function MyHandler() {
|
||||
}
|
||||
|
||||
/** Another handler.
|
||||
* @listens module:myModule.MyEvent
|
||||
*/
|
||||
function AnotherHandler() {
|
||||
}
|
||||
|
||||
/** a namespace.
|
||||
* @namespace */
|
||||
var Events = {
|
||||
};
|
||||
|
||||
/** Another event (has listeners).
|
||||
* @event Event2
|
||||
* @memberof module:myModule~Events
|
||||
*/
|
||||
|
||||
/** An event with no listeners.
|
||||
* @event module:myModule#Event3 */
|
||||
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
describe("@listens tag", function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/listenstag.js'),
|
||||
doc = docSet.getByLongname('handler')[0];
|
||||
doc = docSet.getByLongname('module:myModule~MyHandler')[0];
|
||||
|
||||
it("should create a 'listens' property on the doclet, an array, with the events that are listened to", function() {
|
||||
it("should create a 'listens' property on the doclet, an array, with the events that are listened to (with event namespace)", function() {
|
||||
expect(Array.isArray(doc.listens)).toBeTruthy();
|
||||
expect(doc.listens.length).toBe(2);
|
||||
expect(doc.listens).toContain('event:Foo');
|
||||
expect(doc.listens).toContain('event:Bar');
|
||||
expect(doc.listens).toContain('module:myModule.event:MyEvent');
|
||||
expect(doc.listens).toContain('module:myModule~Events.event:Event2');
|
||||
});
|
||||
|
||||
it("includes events even if non-existent", function() {
|
||||
expect(doc.listens.length).toBe(3);
|
||||
expect(doc.listens).toContain('event:fakeEvent');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user