callback.js 949 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. describe('callback tag', function() {
  3. var docSet = jasmine.getDocSetFromFile('test/fixtures/callbacktag.js');
  4. function callbackTests(callback) {
  5. expect(callback).toBeDefined();
  6. expect(callback.type).toBeDefined();
  7. expect(typeof callback.type).toEqual('object');
  8. expect(callback.type.names).toBeDefined();
  9. expect(callback.type.names instanceof Array).toEqual(true);
  10. expect(callback.type.names.length).toEqual(1);
  11. expect(callback.type.names[0]).toEqual('function');
  12. }
  13. it('correctly handles callbacks that do not define a {type}', function() {
  14. var callback = docSet.getByLongname('requestResponseCallback')[0];
  15. callbackTests(callback);
  16. });
  17. it('correctly handles callbacks that define an incorrect {type}', function() {
  18. var callback = docSet.getByLongname('wrongTypeCallback')[0];
  19. callbackTests(callback);
  20. });
  21. });