arrowfunction.js 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. describe('arrow functions', function() {
  3. var docSet = jasmine.getDocSetFromFile('test/fixtures/arrowfunction.js');
  4. var increment = docSet.getByLongname('increment')[0];
  5. var print = docSet.getByLongname('print')[0];
  6. var name = docSet.getByLongname('<anonymous>#name');
  7. it('should use the correct name and longname', function() {
  8. expect(increment).toBeDefined();
  9. expect(increment.name).toBe('increment');
  10. });
  11. it('should allow function parameters to be documented', function() {
  12. expect(increment.params.length).toBe(1);
  13. expect(increment.params[0].name).toBe('n');
  14. });
  15. it('should support inline comments on parameters', function() {
  16. expect(print.params.length).toBe(1);
  17. expect(print.params[0].type.names[0]).toBe('*');
  18. });
  19. // TODO: we currently use the wrong longname in this case; see
  20. // `module:jsdoc/src/astnode.nodeToValue` and the comment on `case Syntax.MethodDefinition` for
  21. // details
  22. xit('should use the correct longname for members of a class returned by an arrow function',
  23. function() {
  24. expect(name.length).toBe(2);
  25. });
  26. });