Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back basename support in match() #3054

Merged
merged 1 commit into from
Feb 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}