In Binding.formattedValue, do not directly access the model; use
adapter.read instead. This broke 1 test case. Going forward, adapter.read *must* do something sensible, at the least doing an object[key].
Showing
2 changed files
with
4 additions
and
3 deletions
... | @@ -6,7 +6,7 @@ describe('Rivets.Binding', function() { | ... | @@ -6,7 +6,7 @@ describe('Rivets.Binding', function() { |
6 | adapter: { | 6 | adapter: { |
7 | subscribe: function() {}, | 7 | subscribe: function() {}, |
8 | unsubscribe: function() {}, | 8 | unsubscribe: function() {}, |
9 | read: function() {}, | 9 | read: function(model, key) { return model[key]; }, |
10 | publish: function() {} | 10 | publish: function() {} |
11 | } | 11 | } |
12 | }); | 12 | }); | ... | ... |
... | @@ -41,8 +41,9 @@ class Rivets.Binding | ... | @@ -41,8 +41,9 @@ class Rivets.Binding |
41 | args = formatter.split /\s+/ | 41 | args = formatter.split /\s+/ |
42 | id = args.shift() | 42 | id = args.shift() |
43 | 43 | ||
44 | formatter = if model[id] instanceof Function | 44 | m = Rivets.config.adapter.read model, id |
45 | model[id] | 45 | formatter = if m instanceof Function |
46 | m | ||
46 | else | 47 | else |
47 | Rivets.formatters[id] | 48 | Rivets.formatters[id] |
48 | 49 | ... | ... |
-
Please register or sign in to post a comment