This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("When deleting a record that has a belongsTo relationship, the record is removed from the inverse but still has access to its own relationship - async", function () { | |
User.reopen({ | |
observesBestFriend: Ember.observer('bestFriend', function () { | |
this.get('bestFriend'); | |
}) | |
}); | |
var stanleysFriend = store.push('user', {id:2, name: "Stanley's friend"}); | |
var stanley = store.push('user', {id:1, name: 'Stanley', bestFriend:2}); | |
stanley.deleteRecord(); | |
stanleysFriend.get('bestFriend').then(async(function(fetchedUser) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Event = DS.Model.extend({ | |
user: DS.belongsTo('user'), | |
project: DS.belongsTo('project', {inverse: null}) | |
}); | |
App.Project = DS.Model.extend({ | |
users: DS.hasMany('user', { async: true, inverse: null}), | |
administrators: DS.hasMany('user', { async: true, inverse: null}), | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadScenarioViewController(project, model, actionDefinition) { | |
var controller, store = App.TestHelper.lookupStore(), | |
router = App.__container__.lookup('router:main'), | |
commander = App.Commander.create({store: store}), | |
App.__container__.register("controller:project", Ember.ObjectController.extend({content: project})); | |
controller = App.ScenarioController.create({ | |
container: App.__container__, | |
target: router, | |
content: model, |
NewerOlder