Skip to content

Commit

Permalink
Reset the notes collection html when rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolm Locke committed Oct 27, 2011
1 parent 66e6b6f commit 2a02af1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion public/javascripts/views/story_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var StoryView = FormView.extend({
this.model.bind("change:estimate", this.setClassName);
this.model.bind("change:state", this.setClassName);

this.model.bind("change:notes", this.renderNotes);
this.model.bind("change:notes", this.renderNotesCollection);

this.model.bind("render", this.hoverBox());
// Supply the model with a reference to it's own view object, so it can
Expand Down Expand Up @@ -375,6 +375,7 @@ var StoryView = FormView.extend({

renderNotesCollection: function() {
var notelist = this.$('div.notelist');
notelist.html('');
this.model.notes.each(function(note) {
var view;
if (note.isNew()) {
Expand Down
4 changes: 2 additions & 2 deletions spec/javascripts/views/story_view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ describe('StoryView', function() {

describe("notes", function() {

it("binds change:notes to renderNotes()", function() {
it("binds change:notes to renderNotesCollection()", function() {
var spy = sinon.spy(this.story, 'bind');
var view = new StoryView({model: this.story});
expect(spy).toHaveBeenCalledWith('change:notes', view.renderNotes);
expect(spy).toHaveBeenCalledWith('change:notes', view.renderNotesCollection);
});

});
Expand Down

0 comments on commit 2a02af1

Please sign in to comment.