Created
January 16, 2013 15:47
-
-
Save trabianmatt/4548122 to your computer and use it in GitHub Desktop.
Bindings test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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