@ -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, from, interval, of } from 'rxjs';
|
||||
import {from, interval, Observable, of} from 'rxjs';
|
||||
import {elementAt, every, filter, find, findIndex, first, flatMap, groupBy, ignoreElements, isEmpty, last, map, mapTo, max, min, reduce, repeat, scan, single, skip, skipUntil, skipWhile, startWith} from 'rxjs/operators';
|
||||
|
||||
import {asyncTest, isPhantomJS} from '../test-util';
|
||||
@ -20,13 +20,17 @@ describe('Observable.collection', () => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||
});
|
||||
|
||||
afterEach(function() { jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultTimeout; });
|
||||
afterEach(function() {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultTimeout;
|
||||
});
|
||||
|
||||
it('elementAt func callback should run in the correct zone', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3).pipe(elementAt(1)); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3).pipe(elementAt(1));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -34,7 +38,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -48,7 +54,9 @@ describe('Observable.collection', () => {
|
||||
const everyZone1: Zone = Zone.current.fork({name: 'Every Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = everyZone1.run(() => {
|
||||
return observable1.pipe(every((v: any) => {
|
||||
@ -63,7 +71,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -77,7 +87,9 @@ describe('Observable.collection', () => {
|
||||
const filterZone1: Zone = Zone.current.fork({name: 'Filter Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = filterZone1.run(() => {
|
||||
return observable1.pipe(filter((v: any) => {
|
||||
@ -92,7 +104,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -106,7 +120,9 @@ describe('Observable.collection', () => {
|
||||
const findZone1: Zone = Zone.current.fork({name: 'Find Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = findZone1.run(() => {
|
||||
return observable1.pipe(find((v: any) => {
|
||||
@ -121,7 +137,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -135,7 +153,9 @@ describe('Observable.collection', () => {
|
||||
const findZone1: Zone = Zone.current.fork({name: 'Find Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = findZone1.run(() => {
|
||||
return observable1.pipe(findIndex((v: any) => {
|
||||
@ -150,7 +170,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -164,7 +186,9 @@ describe('Observable.collection', () => {
|
||||
const firstZone1: Zone = Zone.current.fork({name: 'First Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = firstZone1.run(() => {
|
||||
return observable1.pipe(first((v: any) => {
|
||||
@ -179,7 +203,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -221,7 +247,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error' + err); },
|
||||
(err: any) => {
|
||||
fail('should not call error' + err);
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -238,12 +266,18 @@ describe('Observable.collection', () => {
|
||||
const ignoreZone1: Zone = Zone.current.fork({name: 'Ignore Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3).pipe(ignoreElements()); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3).pipe(ignoreElements());
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
(result: any) => { fail('should not call next'); },
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(result: any) => {
|
||||
fail('should not call next');
|
||||
},
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -257,7 +291,9 @@ describe('Observable.collection', () => {
|
||||
const isEmptyZone1: Zone = Zone.current.fork({name: 'IsEmpty Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3).pipe(isEmpty()); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3).pipe(isEmpty());
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -265,7 +301,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -279,7 +317,9 @@ describe('Observable.collection', () => {
|
||||
const lastZone1: Zone = Zone.current.fork({name: 'Last Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3).pipe(last()); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3).pipe(last());
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -287,7 +327,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -301,7 +343,9 @@ describe('Observable.collection', () => {
|
||||
const mapZone1: Zone = Zone.current.fork({name: 'Map Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = mapZone1.run(() => {
|
||||
return observable1.pipe(map((v: any) => {
|
||||
@ -316,7 +360,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -330,9 +376,13 @@ describe('Observable.collection', () => {
|
||||
const mapToZone1: Zone = Zone.current.fork({name: 'MapTo Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = mapToZone1.run(() => { return observable1.pipe(mapTo('a')); });
|
||||
observable1 = mapToZone1.run(() => {
|
||||
return observable1.pipe(mapTo('a'));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -340,7 +390,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -353,7 +405,9 @@ describe('Observable.collection', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (4, 2, 3).pipe(max()); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(4, 2, 3).pipe(max());
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -361,7 +415,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -375,7 +431,9 @@ describe('Observable.collection', () => {
|
||||
const maxZone1: Zone = Zone.current.fork({name: 'Max Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (4, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(4, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = maxZone1.run(() => {
|
||||
return observable1.pipe(max((x: number, y: number) => {
|
||||
@ -390,7 +448,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -403,7 +463,9 @@ describe('Observable.collection', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (4, 2, 3).pipe(min()); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(4, 2, 3).pipe(min());
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -411,7 +473,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -425,7 +489,9 @@ describe('Observable.collection', () => {
|
||||
const minZone1: Zone = Zone.current.fork({name: 'Min Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
const error = new Error('test');
|
||||
observable1 = constructorZone1.run(() => { return of (4, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(4, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = minZone1.run(() => {
|
||||
return observable1.pipe(max((x: number, y: number) => {
|
||||
@ -440,7 +506,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -453,7 +521,9 @@ describe('Observable.collection', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const reduceZone1: Zone = Zone.current.fork({name: 'Min Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return of (4, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(4, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = reduceZone1.run(() => {
|
||||
return observable1.pipe(reduce((acc: number, one: number) => {
|
||||
@ -468,7 +538,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -481,7 +553,9 @@ describe('Observable.collection', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const scanZone1: Zone = Zone.current.fork({name: 'Min Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return of (4, 2, 3); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(4, 2, 3);
|
||||
});
|
||||
|
||||
observable1 = scanZone1.run(() => {
|
||||
return observable1.pipe(scan((acc: number, one: number) => {
|
||||
@ -496,7 +570,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -508,7 +584,9 @@ describe('Observable.collection', () => {
|
||||
it('repeat func callback should run in the correct zone', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return of (1).pipe(repeat(2)); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1).pipe(repeat(2));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -516,7 +594,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -529,7 +609,9 @@ describe('Observable.collection', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const singleZone1: Zone = Zone.current.fork({name: 'Single Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3, 4, 5); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3, 4, 5);
|
||||
});
|
||||
|
||||
observable1 = singleZone1.run(() => {
|
||||
return observable1.pipe(single((val: any) => {
|
||||
@ -544,7 +626,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -556,7 +640,9 @@ describe('Observable.collection', () => {
|
||||
it('skip func callback should run in the correct zone', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2, 3, 4, 5).pipe(skip(3)); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2, 3, 4, 5).pipe(skip(3));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
observable1.subscribe(
|
||||
@ -564,7 +650,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -576,8 +664,9 @@ describe('Observable.collection', () => {
|
||||
xit('skipUntil func callback should run in the correct zone', asyncTest((done: any) => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 =
|
||||
constructorZone1.run(() => { return interval(10).pipe(skipUntil(interval(25))); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return interval(10).pipe(skipUntil(interval(25)));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
const subscriber = observable1.subscribe(
|
||||
@ -586,7 +675,9 @@ describe('Observable.collection', () => {
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
subscriber.unsubscribe();
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
@ -600,7 +691,9 @@ describe('Observable.collection', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const skipZone1: Zone = Zone.current.fork({name: 'Skip Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return interval(10); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return interval(10);
|
||||
});
|
||||
|
||||
observable1 = skipZone1.run(() => {
|
||||
return observable1.pipe(skipWhile((val: any) => {
|
||||
@ -617,14 +710,18 @@ describe('Observable.collection', () => {
|
||||
expect(result).toEqual(2);
|
||||
done();
|
||||
},
|
||||
(err: any) => { fail('should not call error'); });
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
});
|
||||
});
|
||||
}, Zone.root));
|
||||
|
||||
it('startWith func callback should run in the correct zone', () => {
|
||||
const constructorZone1: Zone = Zone.current.fork({name: 'Constructor Zone1'});
|
||||
const subscriptionZone: Zone = Zone.current.fork({name: 'Subscription Zone'});
|
||||
observable1 = constructorZone1.run(() => { return of (1, 2).pipe(startWith(3)); });
|
||||
observable1 = constructorZone1.run(() => {
|
||||
return of(1, 2).pipe(startWith(3));
|
||||
});
|
||||
|
||||
subscriptionZone.run(() => {
|
||||
const subscriber = observable1.subscribe(
|
||||
@ -632,7 +729,9 @@ describe('Observable.collection', () => {
|
||||
log.push(result);
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
},
|
||||
(err: any) => { fail('should not call error'); },
|
||||
(err: any) => {
|
||||
fail('should not call error');
|
||||
},
|
||||
() => {
|
||||
log.push('completed');
|
||||
expect(Zone.current.name).toEqual(subscriptionZone.name);
|
||||
|
Reference in New Issue
Block a user