restparams.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. describe('rest parameters', function() {
  3. var docSet = jasmine.getDocSetFromFile('test/fixtures/restparams.js');
  4. var setAdmins = docSet.getByLongname('setAdmins')[0];
  5. var setManagers = docSet.getByLongname('setManagers')[0];
  6. var setWidgetAccess = docSet.getByLongname('setWidgetAccess')[0];
  7. it('should automatically mark standalone rest parameters as repeatable', function() {
  8. var restParam = setAdmins.params[0];
  9. expect(restParam.name).toBe('users');
  10. expect(restParam.variable).toBe(true);
  11. });
  12. it('should automatically mark rest parameters as repeatable when they are mixed with other params', function() {
  13. var restParam = setWidgetAccess.params[1];
  14. expect(restParam.name).toBe('users');
  15. expect(restParam.variable).toBe(true);
  16. });
  17. it('should automatically mark rest parameters as repeatable when the function is assigned to a variable', function() {
  18. var restParam = setManagers.params[0];
  19. expect(restParam.name).toBe('users');
  20. expect(restParam.variable).toBe(true);
  21. });
  22. describe('ES2015 methods', function() {
  23. var docSet2 = jasmine.getDocSetFromFile('test/fixtures/restparams2.js');
  24. var addUsers = docSet2.getByLongname('Widget#addUsers')[0];
  25. it('should autodetect rest parameters', function() {
  26. expect(addUsers.params[0].variable).toBe(true);
  27. });
  28. });
  29. });