Skip to content

Commit

Permalink
Merge pull request #3054 from rackt/server-basename
Browse files Browse the repository at this point in the history
Add back basename support in match()
  • Loading branch information
taion committed Feb 10, 2016
2 parents 1a81557 + d4a925a commit a759887
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions modules/__tests__/serverRendering-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ describe('server rendering', function () {
})
})

it('accepts a basename option', function (done) {
match({ routes, location: '/dashboard', basename: '/nasebame' }, function (error, redirectLocation, renderProps) {
const string = renderToString(
<RouterContext {...renderProps} />
)
expect(string).toMatch(/\/nasebame/)
done()
})
})

describe('server/client consistency', function () {
// Just render to static markup here to avoid having to normalize markup.

Expand Down
3 changes: 2 additions & 1 deletion modules/createMemoryHistory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import useQueries from 'history/lib/useQueries'
import useBasename from 'history/lib/useBasename'
import baseCreateMemoryHistory from 'history/lib/createMemoryHistory'

export default function createMemoryHistory(options) {
Expand All @@ -7,7 +8,7 @@ export default function createMemoryHistory(options) {
// `useQueries` doesn't understand the signature
const memoryHistory = baseCreateMemoryHistory(options)
const createHistory = () => memoryHistory
const history = useQueries(createHistory)(options)
const history = useQueries(useBasename(createHistory))(options)
history.__v2_compatible__ = true
return history
}

0 comments on commit a759887

Please sign in to comment.