Skip to content

Instantly share code, notes, and snippets.

@ghempton
Created January 8, 2013 04:04
Show Gist options
  • Save ghempton/4481055 to your computer and use it in GitHub Desktop.
Save ghempton/4481055 to your computer and use it in GitHub Desktop.
Bug in new router. This test belongs in basic_test.js
test("Grandparent route context change", function() {
expect(0);
Ember.TEMPLATES.application = compile("{{outlet}}");
Ember.TEMPLATES.posts = compile("{{outlet}}");
Ember.TEMPLATES.post = compile("{{outlet}}");
Ember.TEMPLATES.show = compile("showing");
Ember.TEMPLATES.edit = compile("editing");
Router.map(function(match) {
match("/").to('index');
match("/posts").to("posts", function(match) {
match("/:postId").to('post', function(match) {
match("/").to('show');
match("/edit").to('edit');
});
});
});
App.PostsRoute = Ember.Route.extend({
events: {
showPost: function(context) {
this.transitionTo('show', context);
}
}
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return {id: params.postId}
},
events: {
editPost: function(context) {
this.transitionTo('edit');
}
}
});
bootApplication();
Ember.run(function() {
router.handleURL("/posts/1");
});
Ember.run(function() {
router.send('editPost');
});
Ember.run(function() {
router.send('showPost', {id: 2});
});
Ember.run(function() {
router.send('editPost')
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment