virtual.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict';
  2. describe('virtual symbols', function() {
  3. describe('simple cases', function() {
  4. var docSet = jasmine.getDocSetFromFile('test/fixtures/virtual.js');
  5. var dimensions = docSet.getByLongname('dimensions');
  6. var width = docSet.getByLongname('width');
  7. it('should document virtual symbols', function() {
  8. expect(dimensions.length).toBe(1);
  9. });
  10. it('should document an undocumented symbol found after a comment for a virtual symbol', function() {
  11. expect(width.length).toBe(1);
  12. });
  13. });
  14. describe('complex cases', function() {
  15. var docSet = jasmine.getDocSetFromFile('test/fixtures/virtual2.js');
  16. var say = docSet.getByLongname('Person#say')[0];
  17. var sayCallback = docSet.getByLongname('Person~sayCallback')[0];
  18. it('should document virtual symbols inside an object literal', function() {
  19. expect(sayCallback).toBeDefined();
  20. expect(sayCallback.undocumented).not.toBeDefined();
  21. });
  22. it('should attach the comment to a documented symbol that follows a virtual symbol', function() {
  23. expect(say).toBeDefined();
  24. expect(say.undocumented).not.toBeDefined();
  25. });
  26. });
  27. describe('overloaded virtual symbols', function() {
  28. var docSet = jasmine.getDocSetFromFile('test/fixtures/virtual3.js');
  29. var constructors = docSet.getByLongname('module:connection');
  30. it('should create multiple doclets for overloaded virtual symbols', function() {
  31. expect(constructors).toBeDefined();
  32. expect(constructors.length).toBe(2);
  33. });
  34. it('should use the correct signature for each virtual symbol', function() {
  35. expect(constructors[0]).toBeDefined();
  36. expect(constructors[0].params).toBeDefined();
  37. expect(Array.isArray(constructors[0].params)).toBe(true);
  38. expect(constructors[0].params[0].name).toBe('name');
  39. expect(constructors[1]).toBeDefined();
  40. expect(constructors[1].params).not.toBeDefined();
  41. });
  42. });
  43. });