From 809397d7d715a8662577eee2cda3af39df1fcad7 Mon Sep 17 00:00:00 2001 From: Alex Lande Date: Tue, 8 Sep 2015 16:06:11 -0700 Subject: [PATCH] Add failing tests for route matching with hash --- modules/__tests__/matchRoutes-test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/__tests__/matchRoutes-test.js b/modules/__tests__/matchRoutes-test.js index 2b66af8b27..93ecd4ac1d 100644 --- a/modules/__tests__/matchRoutes-test.js +++ b/modules/__tests__/matchRoutes-test.js @@ -100,6 +100,27 @@ describe('matchRoutes', function () { }); }); + describe('when the location matches a route with hash', function () { + it('matches the correct routes', function (done) { + matchRoutes(routes, createLocation('/users#about'), function (error, match) { + assert(match); + expect(match.routes).toEqual([ RootRoute, UsersRoute, UsersIndexRoute ]); + done(); + }); + }); + }); + + describe('when the location matches a deeply nested route with params and hash', function () { + it('matches the correct routes and params', function (done) { + matchRoutes(routes, createLocation('/users/5/abc#about'), function (error, match) { + assert(match); + expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, PostRoute ]); + expect(match.params).toEqual({ userID: '5', postID: 'abc' }); + done(); + }); + }); + }); + describe('when the location matches an absolute route', function () { it('matches the correct routes', function (done) { matchRoutes(routes, createLocation('/about'), function (error, match) {