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

19 lines
546 B
Plaintext
Raw Normal View History

2011-05-09 02:44:21 +00:00
describe '<%= plural_object_name %>View', ->
view = collection = null
beforeEach ->
collection = new <%= plural_object_name %>()
2011-05-09 11:35:37 +00:00
view = new <%= plural_object_name %>View({collection: collection})
view.render()
2011-05-09 02:44:21 +00:00
it 'should render', ->
expect($(view.el)).toContain('.list')
2011-05-09 11:35:37 +00:00
expect($(view.el)).toContain('button.new')
2011-05-09 02:44:21 +00:00
it 'should add a new model when new is clicked', ->
view.$('button.new').trigger('click')
2011-05-09 11:35:37 +00:00
expect(view.$('.list')).toContain('.<%= css_class_name %>')
2011-05-09 02:44:21 +00:00
expect(collection.length).toEqual(1)