mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Extra tests for @constructor.
This commit is contained in:
parent
33ef0da73c
commit
6db800da84
@ -15,4 +15,9 @@ function Pez() {
|
|||||||
|
|
||||||
/** @constructor */
|
/** @constructor */
|
||||||
Qux = function() {
|
Qux = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var somevar,
|
||||||
|
/** @constructor */
|
||||||
|
Blap = function(a, b) {
|
||||||
|
};
|
||||||
@ -10,19 +10,21 @@
|
|||||||
tag: require('jsdoc/tag'),
|
tag: require('jsdoc/tag'),
|
||||||
parser: require('jsdoc/parser')
|
parser: require('jsdoc/parser')
|
||||||
};
|
};
|
||||||
|
|
||||||
jsdoc.parser.parseFiles(BASEDIR + 'test/samples/tag_constructor.js');
|
jsdoc.parser.parseFiles(BASEDIR + 'test/samples/tag_constructor.js');
|
||||||
doclets = jsdoc.parser.result;
|
|
||||||
|
doclets = jsdoc.parser.result.map(function($){ return $.toObject(); });
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('A doclet from a constructor tag with a name tag and no code', function() {
|
describe('A doclet from a constructor tag with a name tag and no code', function() {
|
||||||
it('should have an `isa` property set to "constructor"', function() {
|
it('should have an `isa` property set to "constructor"', function() {
|
||||||
var doclet = doclets[0].toObject();
|
var doclet = doclets[0];
|
||||||
expect(doclet).to(have_property, 'isa');
|
expect(doclet).to(have_property, 'isa');
|
||||||
expect(doclet.isa).to(eql, 'constructor');
|
expect(doclet.isa).to(eql, 'constructor');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a `name` property set to the given name"', function() {
|
it('should have a `name` property set to the given name"', function() {
|
||||||
var doclet = doclets[0].toObject();
|
var doclet = doclets[0];
|
||||||
expect(doclet).to(have_property, 'name');
|
expect(doclet).to(have_property, 'name');
|
||||||
expect(doclet.name).to(eql, 'Foo');
|
expect(doclet.name).to(eql, 'Foo');
|
||||||
});
|
});
|
||||||
@ -30,13 +32,13 @@
|
|||||||
|
|
||||||
describe('A doclet from a named constructor tag and no code', function() {
|
describe('A doclet from a named constructor tag and no code', function() {
|
||||||
it('should have an `isa` property set to "constructor"', function() {
|
it('should have an `isa` property set to "constructor"', function() {
|
||||||
var doclet = doclets[1].toObject();
|
var doclet = doclets[1];
|
||||||
expect(doclet).to(have_property, 'isa');
|
expect(doclet).to(have_property, 'isa');
|
||||||
expect(doclet.isa).to(eql, 'constructor');
|
expect(doclet.isa).to(eql, 'constructor');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a `name` property set to the given name"', function() {
|
it('should have a `name` property set to the given name"', function() {
|
||||||
var doclet = doclets[1].toObject();
|
var doclet = doclets[1];
|
||||||
expect(doclet).to(have_property, 'name');
|
expect(doclet).to(have_property, 'name');
|
||||||
expect(doclet.name).to(eql, 'Bar');
|
expect(doclet.name).to(eql, 'Bar');
|
||||||
});
|
});
|
||||||
@ -44,13 +46,13 @@
|
|||||||
|
|
||||||
describe('A doclet from a constructor tag and named code', function() {
|
describe('A doclet from a constructor tag and named code', function() {
|
||||||
it('should have an `isa` property set to "constructor"', function() {
|
it('should have an `isa` property set to "constructor"', function() {
|
||||||
var doclet = doclets[2].toObject();
|
var doclet = doclets[2];
|
||||||
expect(doclet).to(have_property, 'isa');
|
expect(doclet).to(have_property, 'isa');
|
||||||
expect(doclet.isa).to(eql, 'constructor');
|
expect(doclet.isa).to(eql, 'constructor');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a `name` property set to the given name"', function() {
|
it('should have a `name` property set to the given name"', function() {
|
||||||
var doclet = doclets[2].toObject();
|
var doclet = doclets[2];
|
||||||
expect(doclet).to(have_property, 'name');
|
expect(doclet).to(have_property, 'name');
|
||||||
expect(doclet.name).to(eql, 'Pez');
|
expect(doclet.name).to(eql, 'Pez');
|
||||||
});
|
});
|
||||||
@ -58,17 +60,31 @@
|
|||||||
|
|
||||||
describe('A doclet from a constructor tag and named anonymous function', function() {
|
describe('A doclet from a constructor tag and named anonymous function', function() {
|
||||||
it('should have an `isa` property set to "constructor"', function() {
|
it('should have an `isa` property set to "constructor"', function() {
|
||||||
var doclet = doclets[3].toObject();
|
var doclet = doclets[3];
|
||||||
expect(doclet).to(have_property, 'isa');
|
expect(doclet).to(have_property, 'isa');
|
||||||
expect(doclet.isa).to(eql, 'constructor');
|
expect(doclet.isa).to(eql, 'constructor');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a `name` property set to the given name"', function() {
|
it('should have a `name` property set to the given name"', function() {
|
||||||
var doclet = doclets[3].toObject();
|
var doclet = doclets[3];
|
||||||
expect(doclet).to(have_property, 'name');
|
expect(doclet).to(have_property, 'name');
|
||||||
expect(doclet.name).to(eql, 'Qux');
|
expect(doclet.name).to(eql, 'Qux');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('A doclet from a constructor tag and named anonymous function part of a var', function() {
|
||||||
|
it('should have an `isa` property set to "constructor"', function() {
|
||||||
|
var doclet = doclets[4];
|
||||||
|
expect(doclet).to(have_property, 'isa');
|
||||||
|
expect(doclet.isa).to(eql, 'constructor');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have a `name` property set to the given name"', function() {
|
||||||
|
var doclet = doclets[4];
|
||||||
|
expect(doclet).to(have_property, 'name');
|
||||||
|
expect(doclet.name).to(eql, 'Blap');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
Loading…
x
Reference in New Issue
Block a user