sync-test.umd.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2022 Google LLC. https://angular.io/
  5. * License: MIT
  6. */
  7. (function (factory) {
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. factory();
  10. })((function () {
  11. 'use strict';
  12. var SyncTestZoneSpec = /** @class */ (function () {
  13. function SyncTestZoneSpec(namePrefix) {
  14. this.runZone = Zone.current;
  15. this.name = 'syncTestZone for ' + namePrefix;
  16. }
  17. SyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  18. switch (task.type) {
  19. case 'microTask':
  20. case 'macroTask':
  21. throw new Error("Cannot call ".concat(task.source, " from within a sync test (").concat(this.name, ")."));
  22. case 'eventTask':
  23. task = delegate.scheduleTask(target, task);
  24. break;
  25. }
  26. return task;
  27. };
  28. return SyncTestZoneSpec;
  29. }());
  30. // Export the class so that new instances can be created with proper
  31. // constructor params.
  32. Zone['SyncTestZoneSpec'] = SyncTestZoneSpec;
  33. }));