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
7 additions
and
1 deletions
... | @@ -15,13 +15,19 @@ describe('Functional', function() { | ... | @@ -15,13 +15,19 @@ 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 | if (obj instanceof Data) { | ||
18 | return obj.get(keypath); | 19 | return obj.get(keypath); |
20 | } | ||
21 | return obj[keypath]; | ||
19 | }, | 22 | }, |
20 | publish: function(obj, keypath, value) { | 23 | publish: function(obj, keypath, value) { |
24 | if (obj instanceof Data) { | ||
21 | attributes = {}; | 25 | attributes = {}; |
22 | attributes[keypath] = value; | 26 | attributes[keypath] = value; |
23 | obj.set(attributes); | 27 | obj.set(attributes); |
24 | } | 28 | } |
29 | obj[keypath] = value; | ||
30 | } | ||
25 | } | 31 | } |
26 | }); | 32 | }); |
27 | }); | 33 | }); | ... | ... |
... | @@ -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