Skip to content

Commit

Permalink
Merge pull request #47 from infinite-networks/addToCollection-return
Browse files Browse the repository at this point in the history
Return added row from addToCollection
  • Loading branch information
merk committed Nov 26, 2015
2 parents cece91a + c144eca commit dcf3168
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Resources/public/js/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
} else {
this.$collection.append($row);
}

return $row;
}
},

Expand Down
7 changes: 7 additions & 0 deletions Tests/Javascript/collection_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@
'Add item skipped because we prevented it with an event');
});

test("Programatic addToCollection returns row", function () {
var collection = setUpCollection('#markup .list-collection');
var result = collection.addToCollection(collection.$prototypes);

equal(result.length, 1, 'addToCollection returned the row');
});

function setUpCollection(selector, options) {
var $fixture = $('#qunit-fixture');

Expand Down

0 comments on commit dcf3168

Please sign in to comment.