Skip to content

Commit

Permalink
fix(skipUntil): fix skipUntil when innerSubscription is null (#3686)
Browse files Browse the repository at this point in the history
* fix(skipUntil): fix skipUntil when innerSubscription is null

* tests(skipUntil): which should emit for a synchronous notifier emits

* style: add space between if and brackets
  • Loading branch information
claylaut authored and benlesh committed May 21, 2018
1 parent afee54a commit 4226432
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions spec/operators/skipUntil-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ describe('skipUntil', () => {
expectSubscriptions(skip.subscriptions).toBe(skipSubs);
});

it('should emit elements after a synchronous notifier emits', () => {
const values: string[] = [];

of('a', 'b').pipe(skipUntil(of('x'))).subscribe(
value => values.push(value),
err => { throw err; },
() => expect(values).to.deep.equal(['a', 'b'])
);
});

it('should raise an error if notifier throws and source is hot', () => {
const e1 = hot('--a--b--c--d--e--|');
const e1subs = '^ ! ';
Expand Down
4 changes: 3 additions & 1 deletion src/internal/operators/skipUntil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ class SkipUntilSubscriber<T, R> extends OuterSubscriber<T, R> {
outerIndex: number, innerIndex: number,
innerSub: InnerSubscriber<T, R>): void {
this.hasValue = true;
this.innerSubscription.unsubscribe();
if (this.innerSubscription) {
this.innerSubscription.unsubscribe();
}
}

notifyComplete() {
Expand Down

0 comments on commit 4226432

Please sign in to comment.