@@ -315,47 +315,14 @@ describe('Watcher', function () {
315
315
} )
316
316
} )
317
317
318
- it ( 'add callback' , function ( done ) {
319
- var watcher = new Watcher ( vm , 'a' , spy )
320
- var spy2 = jasmine . createSpy ( )
321
- watcher . addCb ( spy2 )
322
- vm . a = 99
323
- nextTick ( function ( ) {
324
- expect ( spy ) . toHaveBeenCalledWith ( 99 , 1 )
325
- expect ( spy2 ) . toHaveBeenCalledWith ( 99 , 1 )
326
- done ( )
327
- } )
328
- } )
329
-
330
- it ( 'remove callback' , function ( done ) {
331
- // single, should equal teardown
332
- var fn = function ( ) { }
333
- var watcher = new Watcher ( vm , 'a' , fn )
334
- watcher . removeCb ( fn )
335
- expect ( watcher . active ) . toBe ( false )
336
- expect ( watcher . vm ) . toBe ( null )
337
- expect ( watcher . cbs ) . toBe ( null )
338
- // multiple
339
- watcher = new Watcher ( vm , 'a' , spy )
340
- var spy2 = jasmine . createSpy ( )
341
- watcher . addCb ( spy2 )
342
- watcher . removeCb ( spy )
343
- vm . a = 234
344
- nextTick ( function ( ) {
345
- expect ( spy ) . not . toHaveBeenCalled ( )
346
- expect ( spy2 ) . toHaveBeenCalledWith ( 234 , 1 )
347
- done ( )
348
- } )
349
- } )
350
-
351
318
it ( 'teardown' , function ( done ) {
352
319
var watcher = new Watcher ( vm , 'b.c' , spy )
353
320
watcher . teardown ( )
354
321
vm . b . c = 3
355
322
nextTick ( function ( ) {
356
323
expect ( watcher . active ) . toBe ( false )
357
324
expect ( watcher . vm ) . toBe ( null )
358
- expect ( watcher . cbs ) . toBe ( null )
325
+ expect ( watcher . cb ) . toBe ( null )
359
326
expect ( spy ) . not . toHaveBeenCalled ( )
360
327
done ( )
361
328
} )
@@ -372,21 +339,6 @@ describe('Watcher', function () {
372
339
config . async = true
373
340
} )
374
341
375
- it ( 'handle a cb that triggers removeCb' , function ( ) {
376
- var watcher = new Watcher ( vm , 'a' , spy )
377
- watcher . addCb ( function ( ) {
378
- watcher . removeCb ( spy )
379
- } )
380
- watcher . addCb ( function ( ) { } )
381
- config . async = false
382
- expect ( function ( ) {
383
- vm . a = 2
384
- } ) . not . toThrow ( )
385
- config . async = true
386
- expect ( spy ) . toHaveBeenCalled ( )
387
- expect ( watcher . cbs . length ) . toBe ( 2 )
388
- } )
389
-
390
342
it ( 'warn getter errors' , function ( ) {
391
343
var watcher = new Watcher ( vm , 'd.e + c' , spy )
392
344
expect ( hasWarned ( _ , 'Error when evaluating expression' ) ) . toBe ( true )
0 commit comments