Skip to content

Instantly share code, notes, and snippets.

@trabianmatt
Created January 16, 2013 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trabianmatt/4548122 to your computer and use it in GitHub Desktop.
Save trabianmatt/4548122 to your computer and use it in GitHub Desktop.
Bindings test
helpers = require '../../../helpers'
{ assert } = helpers.chai
describe 'Backbone.View binding', ->
beforeEach ->
class SampleView extends Backbone.View
bindings:
'.name': 'name'
render: ->
@$el.html '<Label class="name" />'
@stickit()
@
@model = new Backbone.Model
name: 'Some Name'
@sampleView = new SampleView
model: @model
@$el = @sampleView.render().$el
it 'should initialize the text of the element based on the passed value', ->
assert.equal @$el.find('Label').text(), 'Some Name'
it 'should update the text of the element when the model changes', ->
@model.set
name: 'Some New Name'
assert.equal @$el.find('Label').text(), 'Some New Name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment