In defaultExpressionParser, remove the direct access to the model on the
first tokenized part of the key; use adapter.read instead. This broke all functional test cases, due to the adapter used therein having to deal with both a normal object, and a Data object.
Showing
2 changed files
with
11 additions
and
5 deletions
... | @@ -15,12 +15,18 @@ describe('Functional', function() { | ... | @@ -15,12 +15,18 @@ describe('Functional', function() { |
15 | obj.on(keypath, callback); | 15 | obj.on(keypath, callback); |
16 | }, | 16 | }, |
17 | read: function(obj, keypath) { | 17 | read: function(obj, keypath) { |
18 | return obj.get(keypath); | 18 | if (obj instanceof Data) { |
19 | return obj.get(keypath); | ||
20 | } | ||
21 | return obj[keypath]; | ||
19 | }, | 22 | }, |
20 | publish: function(obj, keypath, value) { | 23 | publish: function(obj, keypath, value) { |
21 | attributes = {}; | 24 | if (obj instanceof Data) { |
22 | attributes[keypath] = value; | 25 | attributes = {}; |
23 | obj.set(attributes); | 26 | attributes[keypath] = value; |
27 | obj.set(attributes); | ||
28 | } | ||
29 | obj[keypath] = value; | ||
24 | } | 30 | } |
25 | } | 31 | } |
26 | }); | 32 | }); | ... | ... |
... | @@ -182,7 +182,7 @@ defaultExpressionParser = (view, node, type, models, value) -> | ... | @@ -182,7 +182,7 @@ defaultExpressionParser = (view, node, type, models, value) -> |
182 | bindContext: models | 182 | bindContext: models |
183 | firstPart = splitPath.shift() | 183 | firstPart = splitPath.shift() |
184 | model = if firstPart | 184 | model = if firstPart |
185 | models[firstPart] | 185 | Rivets.config.adapter.read models, firstPart |
186 | else | 186 | else |
187 | models | 187 | models |
188 | keypath = splitPath.join '.' | 188 | keypath = splitPath.join '.' | ... | ... |
-
Please register or sign in to post a comment