mercredi 31 décembre 2014

Why this unit test causes 'JSON.stringify cannot serialize cyclic structures' exception?

I want to use a unit test to check if an element is visible after a certain action (_toggleWidget function in this case).



it 'should show the bar after toggle', ->
view = new MyView
view._toggleWidget

expect(view.$navBar).to.be.visible


The test failed with this error message: TypeError: JSON.stringify cannot serialize cyclic structures.


Here is MyView classs



class HeaderView extends Backbone.View

initialize: ->
@$el.html template()
@$navBar = @$ '.nav-bar'

Aucun commentaire:

Enregistrer un commentaire