This repository was archived by the owner on Mar 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 195195 onAuth : function ( callback , context ) {
196196 var self = this ;
197197
198- this . _ref . onAuth ( callback , context ) ;
198+ var fn = this . _utils . debounce ( callback , context , 0 ) ;
199+ this . _ref . onAuth ( fn ) ;
199200
200201 // Return a method to detach the `onAuth()` callback.
201202 return function ( ) {
202- self . _ref . offAuth ( callback , context ) ;
203+ self . _ref . offAuth ( fn ) ;
203204 } ;
204205 } ,
205206
Original file line number Diff line number Diff line change @@ -270,19 +270,21 @@ describe('FirebaseAuth',function(){
270270 } ) ;
271271
272272 describe ( '$onAuth()' , function ( ) {
273- it ( 'calls onAuth() on the backing ref with callback and context provided' , function ( ) {
274- function cb ( ) { }
273+ //todo add more testing here after mockfirebase v2 auth is released
274+
275+ it ( 'calls onAuth() on the backing ref' , function ( ) {
276+ function cb ( ) { }
275277 var ctx = { } ;
276- auth . $onAuth ( cb , ctx ) ;
277- expect ( ref . onAuth ) . toHaveBeenCalledWith ( cb , ctx ) ;
278+ auth . $onAuth ( cb , ctx ) ;
279+ expect ( ref . onAuth ) . toHaveBeenCalledWith ( jasmine . any ( Function ) ) ;
278280 } ) ;
279281
280- it ( 'returns a deregistration function that calls offAuth() on the backing ref with callback and context' , function ( ) {
281- function cb ( ) { }
282+ it ( 'returns a deregistration function that calls offAuth() on the backing ref' , function ( ) {
283+ function cb ( ) { }
282284 var ctx = { } ;
283- var deregister = auth . $onAuth ( cb , ctx ) ;
285+ var deregister = auth . $onAuth ( cb , ctx ) ;
284286 deregister ( ) ;
285- expect ( ref . offAuth ) . toHaveBeenCalledWith ( cb , ctx ) ;
287+ expect ( ref . offAuth ) . toHaveBeenCalledWith ( jasmine . any ( Function ) ) ;
286288 } ) ;
287289 } ) ;
288290
You can’t perform that action at this time.
0 commit comments