a936931b by Michael Richards

Merge branch 'master' into iteration-binding

2 parents ab7fd75f fb1984a9
...@@ -85,6 +85,13 @@ describe('Rivets.Binding', function() { ...@@ -85,6 +85,13 @@ describe('Rivets.Binding', function() {
85 expect(binding.routine).toHaveBeenCalledWith(el, 'awesome sweater'); 85 expect(binding.routine).toHaveBeenCalledWith(el, 'awesome sweater');
86 }); 86 });
87 87
88 it('calls methods with the object as context', function() {
89 binding.model = {foo: 'bar'};
90 spyOn(binding, 'routine');
91 binding.set(function() { return this.foo; });
92 expect(binding.routine).toHaveBeenCalledWith(el, binding.model.foo);
93 });
94
88 describe('on an event binding', function() { 95 describe('on an event binding', function() {
89 beforeEach(function() { 96 beforeEach(function() {
90 binding.options.special = 'event'; 97 binding.options.special = 'event';
......
...@@ -50,7 +50,7 @@ class Rivets.Binding ...@@ -50,7 +50,7 @@ class Rivets.Binding
50 else if @options.special is "iteration" 50 else if @options.special is "iteration"
51 @routine @el, value, @ 51 @routine @el, value, @
52 else 52 else
53 value = value() if value instanceof Function 53 value = value.call(@model) if value instanceof Function
54 @routine @el, value 54 @routine @el, value
55 55
56 # Subscribes to the model for changes at the specified keypath. Bi-directional 56 # Subscribes to the model for changes at the specified keypath. Bi-directional
......