diff --git a/modules/Route.js b/modules/Route.js
index d3d69bdf10..114f2d372e 100644
--- a/modules/Route.js
+++ b/modules/Route.js
@@ -63,7 +63,7 @@ class Route {
var name = options.name;
var path = options.path || name;
- if (path) {
+ if (path && !(options.isDefault || options.isNotFound)) {
if (PathUtils.isAbsolute(path)) {
if (parentRoute) {
invariant(
diff --git a/modules/components/__tests__/DefaultRoute-test.js b/modules/components/__tests__/DefaultRoute-test.js
index 4fcceedbdf..d444219dfa 100644
--- a/modules/components/__tests__/DefaultRoute-test.js
+++ b/modules/components/__tests__/DefaultRoute-test.js
@@ -32,24 +32,24 @@ describe('DefaultRoute', function () {
Router.run(routes, '/foo', function (App) {
var html = React.renderToString();
+ expect(html).toMatch(/Nested/);
expect(html).toMatch(/Foo/);
});
});
- it('renders when no siblings match', function () {
- var routes = (
-
-
-
-
+ describe('with a name', function () {
+ it('renders when the parent route path matches', function () {
+ var routes = (
+
+
-
- );
+ );
- Router.run(routes, '/foo', function (App) {
- var html = React.renderToString();
- expect(html).toMatch(/Foo/);
- expect(html.match(/Bar/)).toEqual(null);
+ Router.run(routes, '/', function (App) {
+ var html = React.renderToString();
+ expect(html).toMatch(/Nested/);
+ expect(html).toMatch(/Foo/);
+ });
});
});
diff --git a/modules/components/__tests__/NotFoundRoute-test.js b/modules/components/__tests__/NotFoundRoute-test.js
index 25991bbf6a..92cf97151d 100644
--- a/modules/components/__tests__/NotFoundRoute-test.js
+++ b/modules/components/__tests__/NotFoundRoute-test.js
@@ -8,7 +8,7 @@ var { Nested, Foo, Bar } = require('../../TestUtils');
describe('NotFoundRoute', function () {
describe('at the root of the config', function () {
- it('renders when no routes match', function () {
+ it('renders when no other routes match', function () {
var routes = ;
Router.run(routes, '/ryans-patience', function (Handler) {
var html = React.renderToString();
@@ -18,7 +18,7 @@ describe('NotFoundRoute', function () {
});
describe('nested in the config', function () {
- it('renders', function () {
+ it('renders when none of its siblings match', function () {
var routes = (
@@ -61,4 +61,20 @@ describe('NotFoundRoute', function () {
});
});
+ describe('with a name', function () {
+ it('renders when none of its siblings match', function () {
+ var routes = (
+
+
+
+
+ );
+
+ Router.run(routes, '/ryans-mind', function (Handler) {
+ var html = React.renderToString();
+ expect(html).toMatch(/Bar/);
+ });
+ });
+ });
+
});