| OLD | NEW |
| 1 library zone_spec; | 1 library zone_spec; |
| 2 | 2 |
| 3 import '../_specs.dart'; | 3 import '../_specs.dart'; |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 main() => describe('zone', () { | 7 main() => describe('zone', () { |
| 8 var zone; | 8 var zone; |
| 9 var exceptionHandler; | 9 var exceptionHandler; |
| 10 beforeEach(module((Module module) { | 10 beforeEach(module((Module module) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 scheduleMicrotask(() { | 39 scheduleMicrotask(() { |
| 40 throw ["async exception"]; | 40 throw ["async exception"]; |
| 41 }); | 41 }); |
| 42 }); | 42 }); |
| 43 | 43 |
| 44 expect(exceptionHandler.errors.length).toEqual(1); | 44 expect(exceptionHandler.errors.length).toEqual(1); |
| 45 expect(exceptionHandler.errors[0].error).toEqual(["async exception"]); | 45 expect(exceptionHandler.errors[0].error).toEqual(["async exception"]); |
| 46 }))); | 46 }))); |
| 47 | 47 |
| 48 | 48 |
| 49 it('should allow executing code outside the zone', inject(() { |
| 50 var zone = new NgZone(); |
| 51 var outerZone = Zone.current; |
| 52 var ngZone; |
| 53 var outsideZone; |
| 54 zone.run(() { |
| 55 ngZone = Zone.current; |
| 56 zone.runOutsideAngular(() { |
| 57 outsideZone = Zone.current; |
| 58 }); |
| 59 }); |
| 60 |
| 61 expect(outsideZone).toEqual(outerZone); |
| 62 expect(ngZone.parent).toEqual((outerZone)); |
| 63 })); |
| 64 |
| 65 |
| 49 it('should rethrow exceptions from the onTurnDone and call onError when the
zone is sync', () { | 66 it('should rethrow exceptions from the onTurnDone and call onError when the
zone is sync', () { |
| 50 zone.onTurnDone = () { | 67 zone.onTurnDone = () { |
| 51 throw ["fromOnTurnDone"]; | 68 throw ["fromOnTurnDone"]; |
| 52 }; | 69 }; |
| 53 | 70 |
| 54 expect(() { | 71 expect(() { |
| 55 zone.run(() { }); | 72 zone.run(() { }); |
| 56 }).toThrow('fromOnTurnDone'); | 73 }).toThrow('fromOnTurnDone'); |
| 57 | 74 |
| 58 expect(exceptionHandler.errors.length).toEqual(1); | 75 expect(exceptionHandler.errors.length).toEqual(1); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 })); | 352 })); |
| 336 | 353 |
| 337 | 354 |
| 338 it('should assertInTurn outside of the zone', () { | 355 it('should assertInTurn outside of the zone', () { |
| 339 expect(async(() { | 356 expect(async(() { |
| 340 zone.assertInTurn(); | 357 zone.assertInTurn(); |
| 341 microLeap(); | 358 microLeap(); |
| 342 })).toThrow('ssertion'); // Support both dart2js and the VM with half a wor
d. | 359 })).toThrow('ssertion'); // Support both dart2js and the VM with half a wor
d. |
| 343 }); | 360 }); |
| 344 }); | 361 }); |
| OLD | NEW |