Skip to content

Commit

Permalink
Test for #14721
Browse files Browse the repository at this point in the history
  • Loading branch information
btecu committed Apr 29, 2019
1 parent be528c4 commit 7aa1d4c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/ember/tests/routing/decoupled_basic_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2910,6 +2910,51 @@ moduleFor(
});
}

['@test The fullfiled model is still available when aborting the transition in `afterModel`'](
assert
) {
assert.expect(2);

this.router.map(function() {
this.route('users');
this.route('index');
});

this.add(
'route:users',
Route.extend({
model() {
return { id: 1 };
},

afterModel(model, transition) {
this._super(...arguments);

assert.ok(model.id === 1, '`model` is available before aborting the transition');
transition.abort();
this.intermediateTransitionTo('index');
},
})
);

this.add(
'route:index',
Route.extend({
setupController() {
this._super(...arguments);

let usersModel = this.modelFor('users');
assert.ok(
usersModel && usersModel.id === 1,
'`model` is available after aborting the transition'
);
},
})
);

return this.visit('/users');
}

async ['@test `didTransition` event fires on the router'](assert) {
assert.expect(3);

Expand Down

0 comments on commit 7aa1d4c

Please sign in to comment.