fix(zone.js): hook should set correct current zone (#31642)

Close #31641

PR Close #31642
This commit is contained in:
JiaLiPassion
2019-07-19 12:20:07 +09:00
committed by Miško Hevery
parent 29e1c53a31
commit 17b32b5fd4
2 changed files with 26 additions and 8 deletions

View File

@ -49,6 +49,22 @@ describe('Zone', function() {
const zoneC = zoneB.fork({name: 'C'});
zoneC.run(function() {});
});
it('should send correct currentZone in hook method when in nested zone with empty implementation',
function() {
const zone = Zone.current;
const zoneA = zone.fork({
name: 'A',
onInvoke: function(
parentDelegate, currentZone, targetZone, callback, applyThis, applyArgs, source) {
expect(currentZone.name).toEqual('A');
return parentDelegate.invoke(targetZone, callback, applyThis, applyArgs, source);
}
});
const zoneB = zoneA.fork({name: 'B'});
const zoneC = zoneB.fork({name: 'C'});
zoneC.run(function() {});
});
});
it('should allow zones to be run from within another zone', function() {