diff --git a/modules/jsdoc/doclet.js b/modules/jsdoc/doclet.js index cd58e1e1..8d78d5d4 100644 --- a/modules/jsdoc/doclet.js +++ b/modules/jsdoc/doclet.js @@ -219,7 +219,7 @@ // other tags that can provide the memberof var memberofs = {methodof: 'method', propertyof: 'property', eventof: 'event'}; // other tags that can provide the symbol name - var nameables = ['constructor', 'const', 'module', 'event', 'namespace', 'method', 'property', 'function', 'variable', 'enum']; + var nameables = ['constructor', 'const', 'module', 'event', 'namespace', 'method', 'property', 'enum']; /** Expand some shortcut tags. Modifies the tags argument in-place. diff --git a/modules/jsdoc/tag.js b/modules/jsdoc/tag.js index d3c9072b..08f4cc17 100644 --- a/modules/jsdoc/tag.js +++ b/modules/jsdoc/tag.js @@ -145,8 +145,9 @@ exports.synonyms = { 'description': 'desc', 'function': 'method', - 'variable': 'member', - 'return': 'returns' + 'variable': 'property', + 'return': 'returns', + 'member': 'memberof' } //TODO: move into a shared module? diff --git a/test/runall.js b/test/runall.js index 5f6104b4..a87b4a36 100644 --- a/test/runall.js +++ b/test/runall.js @@ -8,6 +8,8 @@ load(BASEDIR + '/test/tests/06_jsdoc_tag.js'); load(BASEDIR + '/test/tests/10_tag_constructor.js'); load(BASEDIR + '/test/tests/11_tag_namespace.js'); load(BASEDIR + '/test/tests/12_tag_property.js'); +load(BASEDIR + '/test/tests/13_tag_method.js'); +load(BASEDIR + '/test/tests/14_tag_member.js'); // see http://visionmedia.github.com/jspec/ JSpec.run({ diff --git a/test/tests/01_jsdoc_opts.js b/test/tests/01_jsdoc_opts.js index 338378dc..7fac0add 100644 --- a/test/tests/01_jsdoc_opts.js +++ b/test/tests/01_jsdoc_opts.js @@ -3,7 +3,7 @@ JSpec.describe('jsdoc/opts.js', function() { - before_each(function() { + before(function() { jsdoc = { opts: require('jsdoc/opts') }; }); diff --git a/test/tests/02_jsdoc_src.js b/test/tests/02_jsdoc_src.js index 28033915..a78556f4 100644 --- a/test/tests/02_jsdoc_src.js +++ b/test/tests/02_jsdoc_src.js @@ -3,7 +3,7 @@ JSpec.describe('jsdoc/src.js', function() { - before_each(function() { + before(function() { jsdoc = { src: require('jsdoc/src') }; }); diff --git a/test/tests/03_jsdoc_parser.js b/test/tests/03_jsdoc_parser.js index 10c03df2..bf5a5420 100644 --- a/test/tests/03_jsdoc_parser.js +++ b/test/tests/03_jsdoc_parser.js @@ -3,7 +3,7 @@ JSpec.describe('jsdoc/parser.js', function() { - before_each(function() { + before(function() { jsdoc = { parser: require('jsdoc/parser') }; }); diff --git a/test/tests/04_jsdoc_docset.js b/test/tests/04_jsdoc_docset.js index 8fd4102f..0901309f 100644 --- a/test/tests/04_jsdoc_docset.js +++ b/test/tests/04_jsdoc_docset.js @@ -3,7 +3,7 @@ JSpec.describe('jsdoc/docset.js', function() { - before_each(function() { + before(function() { // docsets can only be created by parsers jsdoc = { parser: require('jsdoc/parser') }; jsdoc.parser.parseFiles(BASEDIR + 'test/tests/04_jsdoc_docset.js'); diff --git a/test/tests/05_jsdoc_doclet.js b/test/tests/05_jsdoc_doclet.js index 94866d50..86a6b400 100644 --- a/test/tests/05_jsdoc_doclet.js +++ b/test/tests/05_jsdoc_doclet.js @@ -4,7 +4,7 @@ JSpec.describe('jsdoc/doclet.js', function() { - before_each(function() { + before(function() { // docsets can only be created by parsers jsdoc = { parser: require('jsdoc/parser') }; jsdoc.parser.parseFiles(BASEDIR + 'test/tests/05_jsdoc_doclet.js'); diff --git a/test/tests/06_jsdoc_tag.js b/test/tests/06_jsdoc_tag.js index 82e33347..4a0072df 100644 --- a/test/tests/06_jsdoc_tag.js +++ b/test/tests/06_jsdoc_tag.js @@ -4,7 +4,7 @@ JSpec.describe('jsdoc/tag.js', function() { - before_each(function() { + before(function() { // docsets can only be created by parsers jsdoc = { tag: require('jsdoc/tag'), diff --git a/test/tests/10_tag_constructor.js b/test/tests/10_tag_constructor.js index e3d76103..07a48aff 100644 --- a/test/tests/10_tag_constructor.js +++ b/test/tests/10_tag_constructor.js @@ -4,7 +4,7 @@ JSpec.describe('@constructor', function() { - before_each(function() { + before(function() { // docsets can only be created by parsers jsdoc = { tag: require('jsdoc/tag'), diff --git a/test/tests/11_tag_namespace.js b/test/tests/11_tag_namespace.js index dd06cc40..7441cc08 100644 --- a/test/tests/11_tag_namespace.js +++ b/test/tests/11_tag_namespace.js @@ -4,7 +4,7 @@ JSpec.describe('@namespace', function() { - before_each(function() { + before(function() { // docsets can only be created by parsers jsdoc = { tag: require('jsdoc/tag'), diff --git a/test/tests/12_tag_property.js b/test/tests/12_tag_property.js index 976965ba..88491e43 100644 --- a/test/tests/12_tag_property.js +++ b/test/tests/12_tag_property.js @@ -4,7 +4,7 @@ JSpec.describe('@property', function() { - before_each(function() { + before(function() { // docsets can only be created by parsers jsdoc = { tag: require('jsdoc/tag'), @@ -12,7 +12,6 @@ }; jsdoc.parser.parseFiles(BASEDIR + 'test/tests/12_tag_property.js'); doclets = jsdoc.parser.result; - }); describe('A doclet with a named property tag attached to a namespace', function() { diff --git a/test/tests/13_tag_method.js b/test/tests/13_tag_method.js new file mode 100644 index 00000000..7fb83c16 --- /dev/null +++ b/test/tests/13_tag_method.js @@ -0,0 +1,70 @@ +(function() { + var jsdoc, + doclets; + + JSpec.describe('@method', function() { + + before(function() { + // docsets can only be created by parsers + jsdoc = { + tag: require('jsdoc/tag'), + parser: require('jsdoc/parser') + }; + jsdoc.parser.parseFiles(BASEDIR + 'test/tests/13_tag_method.js'); + doclets = jsdoc.parser.result; + }); + + describe('A doclet with a named method tag attached to a namespace', function() { + it('should have an `isa` property set to "method"', function() { + var doclet = doclets[2].toObject(); + expect(doclet).to(have_property, 'isa'); + expect(doclet.isa).to(eql, 'method'); + }); + + it('should have a `name` property set to the given name"', function() { + var doclet = doclets[2].toObject(); + expect(doclet).to(have_property, 'name'); + expect(doclet.name).to(eql, 'fah'); + }); + + it('should have a `memberof` property set to the parent object name', function() { + var doclet = doclets[2].toObject(); + expect(doclet).to(have_property, 'memberof'); + expect(doclet.memberof).to(eql, 'foo'); + }); + }); + + describe('A doclet with a named method tag attached to a constructor', function() { + it('should have an `isa` property set to "method"', function() { + var doclet = doclets[3].toObject(); + expect(doclet).to(have_property, 'isa'); + expect(doclet.isa).to(eql, 'method'); + }); + + it('should have a `name` property set to the given name"', function() { + var doclet = doclets[3].toObject(); + expect(doclet).to(have_property, 'name'); + expect(doclet.name).to(eql, 'bah'); + }); + + it('should have a `memberof` property set to the parent object name', function() { + var doclet = doclets[3].toObject(); + expect(doclet).to(have_property, 'memberof'); + expect(doclet.memberof).to(eql, 'bar'); + }); + }); + + }); +})(); + +(function testarea() { + + /** @namespace foo */ + + /** @constructor bar */ + + /** @method foo.fah */ + + /** @method bar.bah */ + +})(); \ No newline at end of file diff --git a/test/tests/14_tag_member.js b/test/tests/14_tag_member.js new file mode 100644 index 00000000..3cfd9afb --- /dev/null +++ b/test/tests/14_tag_member.js @@ -0,0 +1,76 @@ +(function() { + var jsdoc, + doclets; + + JSpec.describe('@member', function() { + + before(function() { + // docsets can only be created by parsers + jsdoc = { + tag: require('jsdoc/tag'), + parser: require('jsdoc/parser') + }; + jsdoc.parser.parseFiles(BASEDIR + 'test/tests/14_tag_member.js'); + doclets = jsdoc.parser.result; + }); + + describe('A doclet with a method tag and a memberof tag', function() { + it('should have an `isa` property set to "method"', function() { + var doclet = doclets[2].toObject(); + expect(doclet).to(have_property, 'isa'); + expect(doclet.isa).to(eql, 'method'); + }); + + it('should have a `name` property set to the given name"', function() { + var doclet = doclets[2].toObject(); + expect(doclet).to(have_property, 'name'); + expect(doclet.name).to(eql, 'fah'); + }); + + it('should have a `memberof` property set to the given member name', function() { + var doclet = doclets[2].toObject(); + expect(doclet).to(have_property, 'memberof'); + expect(doclet.memberof).to(eql, 'foo'); + }); + }); + + describe('A doclet with a property tag and a member tag', function() { + it('should have an `isa` property set to "property"', function() { + var doclet = doclets[3].toObject(); + expect(doclet).to(have_property, 'isa'); + expect(doclet.isa).to(eql, 'property'); + }); + + it('should have a `name` property set to the given name"', function() { + var doclet = doclets[3].toObject(); + expect(doclet).to(have_property, 'name'); + expect(doclet.name).to(eql, 'bah'); + }); + + it('should have a `memberof` property set to the given member name', function() { + var doclet = doclets[3].toObject(); + expect(doclet).to(have_property, 'memberof'); + expect(doclet.memberof).to(eql, 'bar'); + }); + }); + + }); +})(); + +(function testarea() { + + /** @namespace foo */ + + /** @constructor bar */ + + /** + @method fah + @memberof foo + */ + + /** + @property bah + @member bar + */ + +})(); \ No newline at end of file