@ -5,7 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {Observable, observable, of } from 'rxjs';
|
||||
import {Observable, observable, of} from 'rxjs';
|
||||
import {pairwise, partition, pluck} from 'rxjs/operators';
|
||||
|
||||
import {ifEnvSupports} from '../test-util';
|
||||
@ -18,10 +18,14 @@ describe('Observable.map', () => {
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
let observable1: Observable<any>;
|
||||
|
||||
beforeEach(() => { log = []; });
|
||||
beforeEach(() => {
|
||||
log = [];
|
||||
});
|
||||
|
||||
it('pairwise func callback should run in the correct zone', () => {
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3).pipe(pairwise()); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3).pipe(pairwise());
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -29,7 +33,9 @@ describe('Observable.map', () => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push(result);
|
||||
},
|
||||
() => { fail('should not call error'); },
|
||||
() => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push('completed');
|
||||
@ -41,7 +47,9 @@ describe('Observable.map', () => {
|
||||
|
||||
it('partition func callback should run in the correct zone', () => {
|
||||
const partitionZone = Zone.current.fork({name: 'Partition Zone1'});
|
||||
const observable1: any = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
const observable1: any = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
const part: any = partitionZone.run(() => {
|
||||
return observable1.pipe(partition((val: any) => {
|
||||
@ -56,7 +64,9 @@ describe('Observable.map', () => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push('first' + result);
|
||||
},
|
||||
() => { fail('should not call error'); },
|
||||
() => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push('completed');
|
||||
@ -67,7 +77,9 @@ describe('Observable.map', () => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push('second' + result);
|
||||
},
|
||||
() => { fail('should not call error'); },
|
||||
() => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push('completed');
|
||||
@ -78,8 +90,9 @@ describe('Observable.map', () => {
|
||||
});
|
||||
|
||||
it('pluck func callback should run in the correct zone', () => {
|
||||
observable1 =
|
||||
constructorZone1.run(() => { return of ({a: 1, b: 2}, {a: 3, b: 4}).pipe(pluck('a')); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of({a: 1, b: 2}, {a: 3, b: 4}).pipe(pluck('a'));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -87,7 +100,9 @@ describe('Observable.map', () => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push(result);
|
||||
},
|
||||
() => { fail('should not call error'); },
|
||||
() => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
log.push('completed');
|
||||
|
Reference in New Issue
Block a user