objectlit.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. 'use strict';
  2. describe('object literals', function() {
  3. describe('When a child of an objlit has no @name or @memberof tags', function() {
  4. var docSet = jasmine.getDocSetFromFile('test/fixtures/objectlit.js');
  5. var found = docSet.getByLongname('tools.serialiser.value');
  6. it('should have a doclet with the correct longname', function() {
  7. expect(found.length).toBe(1);
  8. });
  9. it('should have a doclet with the correct name', function() {
  10. expect(found[0].name).toBe('value');
  11. });
  12. it('should have the correct memberof', function() {
  13. expect(found[0].memberof).toBe('tools.serialiser');
  14. });
  15. it('should have a static scope', function() {
  16. expect(found[0].scope).toBe('static');
  17. });
  18. });
  19. describe('When a parent of an objlit has no documentation', function() {
  20. var docSet = jasmine.getDocSetFromFile('test/fixtures/objectlit2.js');
  21. var found = docSet.getByLongname('position.axis.x');
  22. it('should have a doclet with the correct longname', function() {
  23. expect(found.length).toBe(1);
  24. });
  25. it('should have a doclet with the correct name', function() {
  26. expect(found[0].name).toBe('x');
  27. });
  28. it('should have the correct memberof', function() {
  29. expect(found[0].memberof).toBe('position.axis');
  30. });
  31. it('should have a static scope', function() {
  32. expect(found[0].scope).toBe('static');
  33. });
  34. });
  35. describe('When an object literal\'s property names must be escaped in a regexp', function() {
  36. var docSet;
  37. var found;
  38. function loadDocSet() {
  39. docSet = jasmine.getDocSetFromFile('test/fixtures/objectlit3.js');
  40. found = docSet.getByLongname('tokens."(".before');
  41. }
  42. it('should not throw an error when creating a doclet', function() {
  43. expect(loadDocSet).not.toThrow();
  44. });
  45. it('should have a doclet with the correct name', function() {
  46. expect(found[0].name).toBe('before');
  47. });
  48. it('should have a doclet with the correct memberof', function() {
  49. expect(found[0].memberof).toBe('tokens."("');
  50. });
  51. });
  52. });