|
1 |
| -/* globals describe, it, expect, expectObservable, hot */ |
| 1 | +/* globals describe, it, expect, expectObservable, expectSubscriptions, hot */ |
2 | 2 | var Rx = require('../../dist/cjs/Rx');
|
3 | 3 | var Observable = Rx.Observable;
|
4 | 4 |
|
5 |
| -describe('Observable.prototype.buffer', function () { |
| 5 | +describe('Observable.prototype.buffer()', function () { |
6 | 6 | it('should work with empty and empty selector', function () {
|
7 | 7 | var a = Observable.empty();
|
8 | 8 | var b = Observable.empty();
|
@@ -167,4 +167,21 @@ describe('Observable.prototype.buffer', function () {
|
167 | 167 | expectObservable(a.buffer(b)).toBe(expected, expectedValues, new Error('too bad'));
|
168 | 168 | expectSubscriptions(a.subscriptions).toBe(subs);
|
169 | 169 | });
|
| 170 | + |
| 171 | + it('should unsubscribe notifier when source unsubscribed', function () { |
| 172 | + var a = hot('--1--2--^--3--4--5---6----7--8--9---0---|'); |
| 173 | + var unsub = ' ! '; |
| 174 | + var subs = '^ ! '; |
| 175 | + var b = hot('--------^--a-------b---cd| '); |
| 176 | + var bsubs = '^ ! '; |
| 177 | + var expected = '---a-------b--- '; |
| 178 | + var expectedValues = { |
| 179 | + a: ['3'], |
| 180 | + b: ['4', '5'] |
| 181 | + }; |
| 182 | + |
| 183 | + expectObservable(a.buffer(b), unsub).toBe(expected, expectedValues); |
| 184 | + expectSubscriptions(a.subscriptions).toBe(subs); |
| 185 | + expectSubscriptions(b.subscriptions).toBe(bsubs); |
| 186 | + }); |
170 | 187 | });
|
0 commit comments