diff --git a/test/fixtures/listenstag.js b/test/fixtures/listenstag.js index d72f1865..50f82da3 100644 --- a/test/fixtures/listenstag.js +++ b/test/fixtures/listenstag.js @@ -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 */ + diff --git a/test/specs/tags/listenstag.js b/test/specs/tags/listenstag.js index 51d90d01..742d5085 100644 --- a/test/specs/tags/listenstag.js +++ b/test/specs/tags/listenstag.js @@ -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'); }); });