mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
process implements tags before augments tags (#906)
This commit is contained in:
parent
028c65c037
commit
8d896db809
@ -513,7 +513,7 @@ exports.addImplemented = function(doclets) {
|
||||
* @return {void}
|
||||
*/
|
||||
exports.augmentAll = function(doclets) {
|
||||
exports.addInherited(doclets);
|
||||
exports.addMixedIn(doclets);
|
||||
exports.addImplemented(doclets);
|
||||
exports.addInherited(doclets);
|
||||
};
|
||||
|
||||
27
test/fixtures/augmentall.js
vendored
Normal file
27
test/fixtures/augmentall.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Parent interface.
|
||||
* @interface
|
||||
*/
|
||||
function Connection() {}
|
||||
|
||||
/**
|
||||
* Open the connection.
|
||||
*/
|
||||
Connection.prototype.open = function() {};
|
||||
|
||||
/**
|
||||
* Child class.
|
||||
* @class
|
||||
* @implements {Connection}
|
||||
*/
|
||||
function Socket() {}
|
||||
|
||||
/** @inheritdoc */
|
||||
Socket.prototype.open = function() {};
|
||||
|
||||
/**
|
||||
* Extension of child class.
|
||||
* @class
|
||||
* @extends {Socket}
|
||||
*/
|
||||
function EncryptedSocket() {}
|
||||
@ -142,7 +142,7 @@ jasmine.asyncSpecDone = function() {
|
||||
jasmine.asyncSpecWait.done = true;
|
||||
};
|
||||
|
||||
jasmine.getDocSetFromFile = function(filename, parser, validate) {
|
||||
jasmine.getDocSetFromFile = function(filename, parser, validate, augment) {
|
||||
var doclets;
|
||||
var validationResult;
|
||||
|
||||
@ -154,8 +154,9 @@ jasmine.getDocSetFromFile = function(filename, parser, validate) {
|
||||
doclets = testParser.parse('javascript:' + sourceCode);
|
||||
jsdoc.borrow.indexAll(doclets);
|
||||
|
||||
jsdoc.augment.addInherited(doclets);
|
||||
jsdoc.augment.addImplemented(doclets);
|
||||
if (augment !== false) {
|
||||
jsdoc.augment.augmentAll(doclets);
|
||||
}
|
||||
|
||||
// test assume borrows have not yet been resolved
|
||||
// require('jsdoc/borrow').resolveBorrows(doclets);
|
||||
|
||||
@ -39,7 +39,7 @@ describe('jsdoc/augment', function() {
|
||||
|
||||
describe('augmentAll', function() {
|
||||
it('should call all other methods that the module exports', function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/mixintag2.js');
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/mixintag2.js', null, null, false);
|
||||
var methodNames = Object.keys(augment).filter(function(name) {
|
||||
return name !== 'augmentAll';
|
||||
});
|
||||
@ -48,11 +48,22 @@ describe('jsdoc/augment', function() {
|
||||
spyOn(augment, name);
|
||||
});
|
||||
|
||||
augment.augmentAll(docSet);
|
||||
augment.augmentAll(docSet.doclets);
|
||||
|
||||
methodNames.forEach(function(name) {
|
||||
expect(augment[name]).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it('should process @implements tags before @augments tags', function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/augmentall.js', null, null, false);
|
||||
var open;
|
||||
|
||||
augment.augmentAll(docSet.doclets);
|
||||
|
||||
open = docSet.getByLongname('EncryptedSocket#open')[0];
|
||||
|
||||
expect(open.description).toBe('Open the connection.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user