Jeff Williams f635b10b6f fix comment-attachment issue (#638)
The issue in brief: Within an object literal, if a standalone comment was followed by a commented symbol, the symbol's comment would not be attached correctly.

The fix essentially reverts the changes for #565, which are no longer needed thanks to 50cd99fa2fca753fcf7c9ec3ecf70afd47168e94.

The fix also corrects the order in which we walk a MemberExpression's child nodes. Without this correction, comments would not be attached correctly inside CallExpression nodes.
2014-04-25 21:53:30 -07:00

34 lines
1.3 KiB
JavaScript

/*global describe, expect, it, jasmine */
describe('virtual symbols', function() {
describe('simple cases', function() {
var docSet = jasmine.getDocSetFromFile('test/fixtures/virtual.js');
var dimensions = docSet.getByLongname('dimensions');
var width = docSet.getByLongname('width');
it('should document virtual symbols', function() {
expect(dimensions.length).toBe(1);
});
it('should document an undocumented symbol found after a comment for a virtual symbol', function() {
expect(width.length).toBe(1);
});
});
describe('complex cases', function() {
var docSet = jasmine.getDocSetFromFile('test/fixtures/virtual2.js');
var say = docSet.getByLongname('Person#say')[0];
var sayCallback = docSet.getByLongname('Person~sayCallback')[0];
it('should document virtual symbols inside an object literal', function() {
expect(sayCallback).toBeDefined();
expect(sayCallback.undocumented).not.toBeDefined();
});
it('should attach the comment to a documented symbol that follows a virtual symbol', function() {
expect(say).toBeDefined();
expect(say.undocumented).not.toBeDefined();
});
});
});