backbone-generator/templates/collection_view_spec.coffee...

19 lines
546 B
Plaintext

describe '<%= plural_object_name %>View', ->
view = collection = null
beforeEach ->
collection = new <%= plural_object_name %>()
view = new <%= plural_object_name %>View({collection: collection})
view.render()
it 'should render', ->
expect($(view.el)).toContain('.list')
expect($(view.el)).toContain('button.new')
it 'should add a new model when new is clicked', ->
view.$('button.new').trigger('click')
expect(view.$('.list')).toContain('.<%= css_class_name %>')
expect(collection.length).toEqual(1)