Skip to content

Commit

Permalink
didLoad should fire even if the record isEmpty
Browse files Browse the repository at this point in the history
Fixes #1317
  • Loading branch information
wycats committed Sep 19, 2013
1 parent 14cd3e3 commit a29dbcf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ember-data/lib/system/model/states.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ var RootState = {

pushedData: function(record) {
record.transitionTo('loaded.saved');
record.triggerLater('didLoad');
}
},

Expand Down
14 changes: 14 additions & 0 deletions packages/ember-data/tests/unit/store/push_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ test("Calling push with a normalized hash returns a record", function() {
}));
});

test("Calling push triggers `didLoad` even if the record hasn't been requested from the adapter", function() {
Person.reopen({
didLoad: async(function() {
ok(true, "The didLoad callback was called");
})
});

store.push('person', {
id: 'wat',
firstName: "Yehuda",
lastName: "Katz"
});
});

test("Calling update with partial records updates just those attributes", function() {
var person = store.push('person', {
id: 'wat',
Expand Down

0 comments on commit a29dbcf

Please sign in to comment.