Skip to content

Commit

Permalink
test(takeWhile): add test against breaking unsubscription chain
Browse files Browse the repository at this point in the history
Relates to #875.
  • Loading branch information
figueredo authored and benlesh committed Dec 8, 2015
1 parent b1ae119 commit d7438b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/operators/takeWhile-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,23 @@ describe('Observable.prototype.takeWhile()', function () {
expectObservable(e1.takeWhile(predicate), unsub).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});

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

function predicate(value) {
return value !== 'd';
}

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

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

0 comments on commit d7438b5

Please sign in to comment.