sync-test.umd.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2025 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. function patchSyncTest(Zone) {
  13. var SyncTestZoneSpec = /** @class */ (function () {
  14. function SyncTestZoneSpec(namePrefix) {
  15. this.runZone = Zone.current;
  16. this.name = 'syncTestZone for ' + namePrefix;
  17. }
  18. SyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  19. switch (task.type) {
  20. case 'microTask':
  21. case 'macroTask':
  22. throw new Error("Cannot call ".concat(task.source, " from within a sync test (").concat(this.name, ")."));
  23. case 'eventTask':
  24. task = delegate.scheduleTask(target, task);
  25. break;
  26. }
  27. return task;
  28. };
  29. return SyncTestZoneSpec;
  30. }());
  31. // Export the class so that new instances can be created with proper
  32. // constructor params.
  33. Zone['SyncTestZoneSpec'] = SyncTestZoneSpec;
  34. }
  35. patchSyncTest(Zone);
  36. }));