Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/cdk/scrolling/scroll-dispatcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ describe('Scroll Dispatcher', () => {

expect(spy).toHaveBeenCalledTimes(1);
});

it('should complete the `scrolled` stream on destroy', () => {
const completeSpy = jasmine.createSpy('complete spy');
const subscription = scroll.scrolled(0).subscribe(undefined, undefined, completeSpy);

scroll.ngOnDestroy();

expect(completeSpy).toHaveBeenCalled();

subscription.unsubscribe();
});
});

describe('Nested scrollables', () => {
Expand Down
1 change: 1 addition & 0 deletions src/cdk/scrolling/scroll-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class ScrollDispatcher implements OnDestroy {
ngOnDestroy() {
this._removeGlobalListener();
this.scrollContainers.forEach((_, container) => this.deregister(container));
this._scrolled.complete();
}

/**
Expand Down