Skip to content

Commit dcf3168

Browse files
committed
Merge pull request #47 from infinite-networks/addToCollection-return
Return added row from addToCollection
2 parents cece91a + c144eca commit dcf3168

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Resources/public/js/collections.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
} else {
9999
this.$collection.append($row);
100100
}
101+
102+
return $row;
101103
}
102104
},
103105

Tests/Javascript/collection_tests.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@
164164
'Add item skipped because we prevented it with an event');
165165
});
166166

167+
test("Programatic addToCollection returns row", function () {
168+
var collection = setUpCollection('#markup .list-collection');
169+
var result = collection.addToCollection(collection.$prototypes);
170+
171+
equal(result.length, 1, 'addToCollection returned the row');
172+
});
173+
167174
function setUpCollection(selector, options) {
168175
var $fixture = $('#qunit-fixture');
169176

0 commit comments

Comments
 (0)