Skip to content

Commit

Permalink
test(skipUntil): add test against breaking unsubscription chain
Browse files Browse the repository at this point in the history
For issue #875.
  • Loading branch information
staltz authored and kwonoj committed Dec 8, 2015
1 parent d2bd860 commit fbd89c5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/operators/skipUntil-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ describe('Observable.prototype.skipUntil()', function () {
expectSubscriptions(skip.subscriptions).toBe(skipSubs);
});

it('should not break unsubscription chains when result is unsubscribed explicitly', function () {
var e1 = hot('--a--b--c--d--e----|');
var e1subs = '^ ! ';
var skip = hot('-------------x--| ');
var skipSubs = '^ ! ';
var expected = ('---------- ');
var unsub = ' ! ';

var result = e1
.mergeMap(function (x) { return Observable.of(x); })
.skipUntil(skip)
.mergeMap(function (x) { return Observable.of(x); });

expectObservable(result, unsub).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
expectSubscriptions(skip.subscriptions).toBe(skipSubs);
});

it('should skip all element when another observable is empty', function () {
var e1 = hot('--a--b--c--d--e--|');
var e1subs = '^ !';
Expand Down

0 comments on commit fbd89c5

Please sign in to comment.