var.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 'use strict';
  2. describe('var statements', function() {
  3. var docSet = jasmine.getDocSetFromFile('test/fixtures/var.js');
  4. var found = [
  5. docSet.getByLongname('GREEN'),
  6. docSet.getByLongname('RED'),
  7. docSet.getByLongname('validate'),
  8. docSet.getByLongname('i'),
  9. docSet.getByLongname('results')
  10. ];
  11. describe('when a series of constants is documented', function() {
  12. it('should find the first constant', function() {
  13. expect(found[0].length).toBe(1);
  14. });
  15. it('should attach the docs to the first constant', function() {
  16. expect(found[0][0].comment).toBe('/** document me */');
  17. });
  18. it('should have the correct name', function() {
  19. expect(found[0][0].name).toBe('GREEN');
  20. });
  21. it('should have the correct memberof', function() {
  22. expect(found[0][0].memberof).toBeUndefined();
  23. });
  24. it('should give the constant a global scope', function() {
  25. expect(found[0][0].scope).toBe('global');
  26. });
  27. it('should find the second constant', function() {
  28. expect(found[1].length).toBe(1);
  29. });
  30. it('should not attach the docs to the second constant', function() {
  31. expect(found[1][0].undocumented).toBe(true);
  32. });
  33. });
  34. describe('when a member of a series of vars is documented', function() {
  35. it('should attach the docs to the correct var', function() {
  36. expect(found[4][0].comment).toBe('/** document me */');
  37. });
  38. it('should have the correct name', function() {
  39. expect(found[4][0].name).toBe('results');
  40. });
  41. it('should leave memberof undefined', function() {
  42. expect(found[4][0].memberof).toBeUndefined();
  43. });
  44. it('should give the var a global scope', function() {
  45. expect(found[4][0].scope).toBe('global');
  46. });
  47. });
  48. });