From 7eb7aa2723cf3dd4bd44d518c340a82fd27c72a0 Mon Sep 17 00:00:00 2001 From: Dzmitry Shylovich Date: Tue, 4 Apr 2017 00:50:54 +0300 Subject: [PATCH] fix(takeUntil): complete an observable when notifier completes Closes #2160 --- spec/operators/takeUntil-spec.ts | 12 ++++++------ src/operator/takeUntil.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/operators/takeUntil-spec.ts b/spec/operators/takeUntil-spec.ts index b2a2288409..8896e791ca 100644 --- a/spec/operators/takeUntil-spec.ts +++ b/spec/operators/takeUntil-spec.ts @@ -35,12 +35,12 @@ describe('Observable.prototype.takeUntil', () => { expectSubscriptions(e2.subscriptions).toBe(e2subs); }); - it('should take all values when notifier is empty', () => { + it('should take values until notifier completes', () => { const e1 = hot('--a--b--c--d--e--f--g--|'); - const e1subs = '^ !'; + const e1subs = '^ ! '; const e2 = hot('-------------| '); const e2subs = '^ ! '; - const expected = '--a--b--c--d--e--f--g--|'; + const expected = '--a--b--c--d-| '; expectObservable(e1.takeUntil(e2)).toBe(expected); expectSubscriptions(e1.subscriptions).toBe(e1subs); @@ -96,12 +96,12 @@ describe('Observable.prototype.takeUntil', () => { expectSubscriptions(e2.subscriptions).toBe(e2subs); }); - it('should not complete when notifier is empty if source observable does not complete', () => { + it('should complete when notifier is empty even if source observable does not complete', () => { const e1 = hot('-'); - const e1subs = '^'; + const e1subs = '^ !'; const e2 = hot('--|'); const e2subs = '^ !'; - const expected = '---'; + const expected = '--|'; expectObservable(e1.takeUntil(e2)).toBe(expected); expectSubscriptions(e1.subscriptions).toBe(e1subs); diff --git a/src/operator/takeUntil.ts b/src/operator/takeUntil.ts index 070d558433..a2e439b31a 100644 --- a/src/operator/takeUntil.ts +++ b/src/operator/takeUntil.ts @@ -73,6 +73,6 @@ class TakeUntilSubscriber extends OuterSubscriber { } notifyComplete(): void { - // noop + this.complete(); } }