File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ describe('Subscriber', () => {
8585 } ) ;
8686
8787 it ( 'should not be closed when other subscriber with same observer instance completes' , ( ) => {
88- let observer = {
88+ const observer = {
8989 next : function ( ) { /*noop*/ }
9090 } ;
9191
@@ -97,4 +97,19 @@ describe('Subscriber', () => {
9797 expect ( sub1 . closed ) . to . be . false ;
9898 expect ( sub2 . closed ) . to . be . true ;
9999 } ) ;
100+
101+ it ( 'should call complete observer without any arguments' , ( ) => {
102+ let argument : Array < any > = null ;
103+
104+ const observer = {
105+ complete : ( ...args : Array < any > ) => {
106+ argument = args ;
107+ }
108+ } ;
109+
110+ const sub1 = new Subscriber ( observer ) ;
111+ sub1 . complete ( ) ;
112+
113+ expect ( argument ) . to . have . lengthOf ( 0 ) ;
114+ } ) ;
100115} ) ;
Original file line number Diff line number Diff line change @@ -234,11 +234,13 @@ class SafeSubscriber<T> extends Subscriber<T> {
234234 if ( ! this . isStopped ) {
235235 const { _parentSubscriber } = this ;
236236 if ( this . _complete ) {
237+ const wrappedComplete = ( ) => this . _complete . call ( this . _context ) ;
238+
237239 if ( ! _parentSubscriber . syncErrorThrowable ) {
238- this . __tryOrUnsub ( this . _complete ) ;
240+ this . __tryOrUnsub ( wrappedComplete ) ;
239241 this . unsubscribe ( ) ;
240242 } else {
241- this . __tryOrSetError ( _parentSubscriber , this . _complete ) ;
243+ this . __tryOrSetError ( _parentSubscriber , wrappedComplete ) ;
242244 this . unsubscribe ( ) ;
243245 }
244246 } else {
You can’t perform that action at this time.
0 commit comments