Permalink
Browse files

Mix Ember.Routable into Ember.Route instead of Ember.State

  • Loading branch information...
wagenet committed Jun 13, 2012
1 parent 927cf87 commit d8383b65aaf9dcd0f92687b7ed6921f1a436a73c
@@ -67,8 +67,8 @@ test("it sets an URL with a context", function() {
setURL: Ember.K
},
namespace: namespace,
root: Ember.State.create({
index: Ember.State.create({
root: Ember.Route.create({
index: Ember.Route.create({
route: '/',
showDashboard: function(router) {
@@ -80,7 +80,7 @@ test("it sets an URL with a context", function() {
}
}),
dashboard: Ember.State.create({
dashboard: Ember.Route.create({
route: '/dashboard/:component_id'
})
})
@@ -131,8 +131,8 @@ test('initialized application go to initial route', function() {
onUpdateURL: function() {}
},
root: Ember.State.extend({
index: Ember.State.extend({
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/'
})
})
@@ -166,8 +166,8 @@ test("initialize application with stateManager via initialize call", function()
app.Router = Ember.Router.extend({
location: 'none',
root: Ember.State.extend({
index: Ember.State.extend({
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/'
})
})
@@ -190,8 +190,8 @@ test("initialize application with stateManager via initialize call from Router c
app.Router = Ember.Router.extend({
location: 'none',
root: Ember.State.extend({
index: Ember.State.extend({
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/'
})
})
@@ -263,8 +263,8 @@ test("ApplicationView is inserted into the page", function() {
app.Router = Ember.Router.extend({
location: 'none',
root: Ember.State.extend({
index: Ember.State.extend({
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/'
})
})
@@ -7,4 +7,5 @@
require('ember-runtime');
require('ember-states/state_manager');
require('ember-states/state');
require('ember-states/route');
require('ember-states/router');
@@ -321,5 +321,3 @@ Ember.Routable = Ember.Mixin.create({
*/
connectOutlets: Ember.K
});
Ember.State.reopen(Ember.Routable);
@@ -0,0 +1,7 @@
require('ember-states/state');
require('ember-states/routable');
/**
@class
*/
Ember.Route = Ember.State.extend(Ember.Routable);
@@ -8,7 +8,7 @@ test("it should have its updateRoute method called when it is entered", function
expect(2);
var state = Ember.State.create({
var state = Ember.Route.create({
route: 'foo',
updateRoute: function(manager, location) {
ok(true, "updateRoute was called");
@@ -18,7 +18,7 @@ test("it should have its updateRoute method called when it is entered", function
var router = Ember.Router.create({
location: locationStub,
root: Ember.State.create({
root: Ember.Route.create({
ready: function(manager) {
manager.transitionTo('initial');
},
@@ -80,39 +80,14 @@ test("a RouteMatcher generates routes with dynamic segments", function() {
});
test("route repeatedly descends into a nested hierarchy", function() {
var state = Ember.State.create({
fooChild: Ember.State.create({
var state = Ember.Route.create({
fooChild: Ember.Route.create({
route: 'foo',
barChild: Ember.State.create({
barChild: Ember.Route.create({
route: 'bar',
bazChild: Ember.State.create({
route: 'baz'
})
})
})
});
var router = Ember.Router.create({
location: 'none',
root: state
});
router.route("/foo/bar/baz");
equal(router.getPath('currentState.path'), 'root.fooChild.barChild.bazChild');
});
test("route repeatedly descends into a nested hierarchy", function() {
var state = Ember.State.create({
fooChild: Ember.State.create({
route: 'foo',
barChild: Ember.State.create({
route: 'bar',
bazChild: Ember.State.create({
bazChild: Ember.Route.create({
route: 'baz'
})
})
@@ -130,18 +105,18 @@ test("route repeatedly descends into a nested hierarchy", function() {
});
test("when you descend into a state, the route is set", function() {
var state = Ember.State.create({
var state = Ember.Route.create({
ready: function(manager) {
manager.transitionTo('fooChild.barChild.bazChild');
},
fooChild: Ember.State.create({
fooChild: Ember.Route.create({
route: 'foo',
barChild: Ember.State.create({
barChild: Ember.Route.create({
route: 'bar',
bazChild: Ember.State.create({
bazChild: Ember.Route.create({
route: 'baz'
})
})
@@ -185,7 +160,7 @@ module("Routing Serialization and Deserialization", {
setup: function() {
router = Ember.Router.create({
location: locationMock,
root: Ember.State.create({
root: Ember.Route.create({
ready: function(manager, post) {
manager.transitionTo('post.show', { post: post });
},
@@ -194,18 +169,18 @@ module("Routing Serialization and Deserialization", {
manager.transitionTo('post.index');
},
post: Ember.State.create({
post: Ember.Route.create({
route: '/posts',
index: Ember.State.create({
index: Ember.Route.create({
route: '/',
showPost: function(manager, post) {
manager.transitionTo('post.show', { post: post });
}
}),
show: Ember.State.create({
show: Ember.Route.create({
route: "/:post_id",
connectOutlets: function(manager, context) {
@@ -281,8 +256,8 @@ module("default serialize and deserialize with modelType", {
}
},
root: Ember.State.extend({
post: Ember.State.extend({
root: Ember.Route.extend({
post: Ember.Route.extend({
route: '/posts/:post_id',
modelType: 'TestApp.Post',
@@ -291,7 +266,7 @@ module("default serialize and deserialize with modelType", {
}
}),
user: Ember.State.extend({
user: Ember.Route.extend({
route: '/users/:user_id',
modelType: window.TestApp.User,
@@ -355,8 +330,8 @@ module("default serialize and deserialize without modelType", {
}
},
root: Ember.State.extend({
post: Ember.State.extend({
root: Ember.Route.extend({
post: Ember.Route.extend({
route: '/posts/:post_id',
connectOutlets: function(router, post) {
@@ -390,14 +365,14 @@ module("redirectsTo");
test("if a leaf state has a redirectsTo, it automatically transitions into that state", function() {
var router = Ember.Router.create({
location: 'none',
root: Ember.State.create({
root: Ember.Route.create({
index: Ember.State.create({
index: Ember.Route.create({
route: '/',
redirectsTo: 'someOtherState'
}),
someOtherState: Ember.State.create({
someOtherState: Ember.Route.create({
route: '/other'
})
})
@@ -414,8 +389,8 @@ test("you cannot define connectOutlets AND redirectsTo", function() {
raises(function() {
Ember.Router.create({
location: 'none',
root: Ember.State.create({
index: Ember.State.create({
root: Ember.Route.create({
index: Ember.Route.create({
route: '/',
redirectsTo: 'someOtherState',
connectOutlets: function() {}
@@ -429,10 +404,10 @@ test("you cannot have a redirectsTo in a non-leaf state", function () {
raises(function() {
Ember.Router.create({
location: 'none',
root: Ember.State.create({
root: Ember.Route.create({
redirectsTo: 'someOtherState',
index: Ember.State.create()
index: Ember.Route.create()
})
});
});
@@ -457,8 +432,8 @@ test("urlFor returns an absolute route", function() {
var router = Ember.Router.create({
location: locationStub,
root: Ember.State.create({
dashboard: Ember.State.create({
root: Ember.Route.create({
dashboard: Ember.Route.create({
route: '/dashboard'
})
})
@@ -472,8 +447,8 @@ test("urlFor returns an absolute route", function() {
test("urlFor raises an error when route property is not defined", function() {
var router = Ember.Router.create({
location: locationStub,
root: Ember.State.create({
dashboard: Ember.State.create({}) // state without route property
root: Ember.Route.create({
dashboard: Ember.Route.create({}) // state without route property
})
});
@@ -486,11 +461,11 @@ test("urlFor supports dynamic segments", function() {
var router = Ember.Router.create({
location: locationStub,
root: Ember.State.create({
dashboard: Ember.State.create({
root: Ember.Route.create({
dashboard: Ember.Route.create({
route: '/dashboard',
posts: Ember.State.create({
posts: Ember.Route.create({
route: '/posts/:post_id'
})
})
@@ -512,18 +487,18 @@ test("urlFor supports using the current information for dynamic segments", funct
}
},
root: Ember.State.create({
dashboard: Ember.State.create({
root: Ember.Route.create({
dashboard: Ember.Route.create({
route: '/dashboard',
posts: Ember.State.create({
posts: Ember.Route.create({
route: '/posts/:post_id',
index: Ember.State.create({
index: Ember.Route.create({
route: '/'
}),
manage: Ember.State.create({
manage: Ember.Route.create({
route: '/manage'
})
})
@@ -555,18 +530,18 @@ test("urlFor supports merging the current information for dynamic segments", fun
}
},
root: Ember.State.create({
dashboard: Ember.State.create({
root: Ember.Route.create({
dashboard: Ember.Route.create({
route: '/dashboard',
posts: Ember.State.create({
posts: Ember.Route.create({
route: '/posts/:post_id',
index: Ember.State.create({
index: Ember.Route.create({
route: '/'
}),
manage: Ember.State.create({
manage: Ember.Route.create({
route: '/manage/:widget_id'
})
})
Oops, something went wrong.

0 comments on commit d8383b6

Please sign in to comment.