Created
November 4, 2011 15:36
-
-
Save searls/1339606 to your computer and use it in GitHub Desktop.
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
describe "CallListView", -> | |
beforeEach -> | |
@model = jasmine.createSpyObj('CallList',['bind','moveUp']) | |
@subject = new CallListView model: @model | |
describe "events", -> | |
it "binds to up-arrow clicks", -> | |
expect(@subject.events).toEqual "click .up-arrow": 'moveUp' | |
describe "#moveUp", -> | |
beforeEach -> | |
$upArrow = $(@subject.el).inject('up-arrow').text('C') | |
@subject.moveUp target: $upArrow[0] | |
it "tells the model to move up the arrow's text", -> | |
expect(@model.moveUp).toHaveBeenCalledWith 'C' |
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
class CallListView extends Backbone.View | |
events: | |
"click .up-arrow": "moveUp" | |
moveUp: (e) -> | |
@model.moveUp $(e.target).text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment