Testing backbone.js application with jasmine - how to test model bindings on a view?

前端 未结 6 1610
-上瘾入骨i
-上瘾入骨i 2020-12-24 02:48

I had some interesting tribulations in trying to test whether views were correctly bound to events.  In backbone, we typically bind to events in the initialize method, using

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 03:30

    This may be too closely coupled with Backbone internals, but you can check the callback chain manually:

    expect(this.legendView.groupData._callbacks['change']).toContain(this.myView.render)
    

提交回复
热议问题