@ -6,18 +6,24 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {of , range, zip} from 'rxjs';
|
||||
import {of, range, zip} from 'rxjs';
|
||||
|
||||
describe('Observable.zip', () => {
|
||||
let log: any[];
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
|
||||
beforeEach(() => { log = []; });
|
||||
beforeEach(() => {
|
||||
log = [];
|
||||
});
|
||||
|
||||
it('zip func callback should run in the correct zone', () => {
|
||||
const observable1: any = constructorZone1.run(() => { return range(1, 3); });
|
||||
const observable2: any = constructorZone1.run(() => { return of ('foo', 'bar', 'beer'); });
|
||||
const observable1: any = constructorZone1.run(() => {
|
||||
return range(1, 3);
|
||||
});
|
||||
const observable2: any = constructorZone1.run(() => {
|
||||
return of('foo', 'bar', 'beer');
|
||||
});
|
||||
|
||||
const observable3: any = constructorZone1.run(() => {
|
||||
return zip(observable1, observable2, function(n: number, str: string) {
|
||||
@ -32,7 +38,9 @@ describe('Observable.zip', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
() => { fail('should not call error'); },
|
||||
() => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
|
Reference in New Issue
Block a user