innerscope.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. describe('inner scope', function() {
  3. describe('Outer~inner.member cases', function() {
  4. var docSet = jasmine.getDocSetFromFile('test/fixtures/innerscope.js');
  5. var to = docSet.getByLongname('Message~headers.to');
  6. var from = docSet.getByLongname('Message~headers.from');
  7. var response = docSet.getByLongname('Message~response.code');
  8. it('should occur when a member of a var member is documented.', function() {
  9. expect(to.length).toBe(1);
  10. });
  11. it('should occur when a second member of a var member is documented.', function() {
  12. expect(response.length).toBe(1);
  13. });
  14. it('should occur when a deeply nested member of a var member is documented.', function() {
  15. expect(from.length).toBe(1);
  16. });
  17. });
  18. describe('other cases', function() {
  19. var docSet = jasmine.getDocSetFromFile('test/fixtures/innerscope2.js');
  20. var from = docSet.getByLongname('<anonymous>~headers.from');
  21. var cache = docSet.getByLongname('<anonymous>~headers.cache');
  22. it('When a var is declared in a function, It is like Inner~member', function() {
  23. expect(cache.length).toBe(1);
  24. });
  25. it('When a var is masked by an inner var and a member of the inner is documented, it is like Inner~inner.member', function() {
  26. expect(from.length).toBe(1);
  27. });
  28. it('When a documented member is assigned to a var that masks an outer var.', function() {
  29. expect(from[0].name).toBe('from');
  30. expect(from[0].memberof).toBe('<anonymous>~headers');
  31. });
  32. });
  33. });