Allow the presence of inline tags for a @returns tag that does not have a type spec.

This commit is contained in:
Louis-Dominique Dubeau 2013-06-28 09:33:05 -04:00
parent a507eced37
commit 39bf9adb2b
3 changed files with 17 additions and 2 deletions

View File

@ -35,7 +35,7 @@ function unescapeBraces(text) {
var count = 0; var count = 0;
var position = 0; var position = 0;
var expression = ''; var expression = '';
var startIndex = string.indexOf('{'); var startIndex = string.search(/\{[^@]/);
var textStartIndex; var textStartIndex;
if (startIndex !== -1) { if (startIndex !== -1) {

View File

@ -9,3 +9,11 @@ function find(targetName) {
*/ */
function bind(callback) { function bind(callback) {
} }
// This test exists because there used to be a bug in jsdoc which
// would cause it to fail parsing.
/**
* @return An object to be passed to {@link find}.
*/
function convert(name) {
}

View File

@ -1,7 +1,8 @@
describe("@returns tag", function() { describe("@returns tag", function() {
var docSet = jasmine.getDocSetFromFile('test/fixtures/returnstag.js'), var docSet = jasmine.getDocSetFromFile('test/fixtures/returnstag.js'),
find = docSet.getByLongname('find')[0], find = docSet.getByLongname('find')[0],
bind = docSet.getByLongname('bind')[0]; bind = docSet.getByLongname('bind')[0],
convert = docSet.getByLongname('convert')[0];
it('When a symbol has an @returns tag with a type and description, the doclet has a returns array that includes that return.', function() { it('When a symbol has an @returns tag with a type and description, the doclet has a returns array that includes that return.', function() {
expect(typeof find.returns).toBe('object'); expect(typeof find.returns).toBe('object');
@ -15,4 +16,10 @@ describe("@returns tag", function() {
expect(bind.returns.length).toBe(1); expect(bind.returns.length).toBe(1);
expect(bind.returns[0].description).toBe('The binding id.'); expect(bind.returns[0].description).toBe('The binding id.');
}); });
it('When a symbol has an @returns tag wihtout a type but with an inline tag, the doclet does not confuse the inline tag for a type.', function() {
expect(typeof convert.returns).toBe('object');
expect(convert.returns.length).toBe(1);
expect(convert.returns[0].description).toBe('An object to be passed to {@link find}.');
});
}); });