Skip to content

Commit

Permalink
Added test for change event with wrong model
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenw committed Jul 16, 2014
1 parent 9f97c21 commit 0a73b0b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/modelBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,22 @@ $(document).ready(function() {
view.unstickit();
view.unstickit();
});

test('change with different model', 2, function() {

model.set({'water':'fountain'});
view.model = model;
view.templateId = 'jst10';
view.bindings = {
'.test10': {
observe: 'water',
updateView: function(value, config) {
ok(value == 'fountain');
}
}
};
$('#qunit-fixture').html(view.render().el);
// intentionally pass a wrong model here (this can happen via event bubbling of Backbone.Associations f.e.)
model.trigger('change:water', new Backbone.Model({ 'otherProp': 'value' }));
});
});

0 comments on commit 0a73b0b

Please sign in to comment.