Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: bitovi/canjs
...
head fork: cohuman/canjs
compare: master
  • 4 commits
  • 1 file changed
  • 0 commit comments
  • 3 contributors
Commits on Jan 21, 2013
Daniel Salet Failing test showing new lists being bound when attr'ing nested lists…
… into existing models
9ba3ab0
Commits on Jan 30, 2013
Mindjet Tasks Developer cohuman guard clause around update :( afa74a7
Commits on Apr 23, 2013
Mindjet Tasks Developer cohuman Merge remote-tracking branch 'upstream/master'
Conflicts:
	observe/attributes/attributes_test.js
	view/render.js
293021d
Commits on May 17, 2013
Mindjet Tasks Developer cohuman Merge branch 'master' of https://github.com/bitovi/canjs 67f76ab
Showing with 51 additions and 0 deletions.
  1. +51 −0 observe/attributes/attributes_test.js
51 observe/attributes/attributes_test.js
View
@@ -306,6 +306,57 @@ test("attr does not blow away old observable when going from empty to having ite
equals(project.attr("members").length, 1, "list should have bob in it");
});
+test("Nested List attr()", function(){
+ can.Model('NestedListAttrTest.User', {}, {});
+ can.Model.List('NestedListAttrTest.User.List', {}, {});
+
+ can.Model('NestedListAttrTest.Activity',{
+ attributes : {
+ yayers : "NestedListAttrTest.User.models"
+ }
+ }, {});
+
+ can.Model('NestedListAttrTest.Comment',{
+ attributes : {
+ activity : "NestedListAttrTest.Activity.model"
+ }
+ }, {});
+
+ can.Model('NestedListAttrTest.Task', {
+ attributes : {
+ comments : "NestedListAttrTest.Comment.models"
+ }
+ }, {});
+
+
+ var task = NestedListAttrTest.Task.model({
+ id : 1,
+ comments : [{
+ activity : {
+ yayers : [{id : 3},{id : 27}]
+ }
+ }]
+ });
+
+
+ equal(task.comments[0].activity.yayers instanceof NestedListAttrTest.User.List, true, "the list is a User List");
+ var oldListCid = task.comments[0].activity.attr("yayers")._cid;
+ var oldUserCid = task.comments[0].activity.attr("yayers")[0]._cid
+ task.attr({
+ id : 1,
+ comments : [{
+ activity : {
+ yayers : [{id : 3, name : "Tom"},{id : 27, name : "Jerry"}]
+ }
+ }]
+ });
+
+ equal(oldListCid, task.comments[0].activity.attr("yayers")._cid, "The list is the same list");
+ equal(task.comments[0].activity.attr("yayers")[0]._cid, oldUserCid, "users are the same");
+});
+
+})();
+
test("Default converters and boolean fix (#247)", function() {
var MyObserve = can.Observe({
attributes: {

No commit comments for this range

Something went wrong with that request. Please try again.