Skip to content

Commit

Permalink
use object options for createHref
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Apr 10, 2020
1 parent 052cdea commit 353277d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/core/public/application/scoped_history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ describe('ScopedHistory', () => {
const gh = createMemoryHistory();
gh.push('/app/wow');
const h = new ScopedHistory(gh, '/app/wow');
expect(h.createHref({ pathname: '' }, false)).toEqual(`/`);
expect(h.createHref({ pathname: '/new-page', search: '?alpha=true' }, false)).toEqual(
`/new-page?alpha=true`
);
expect(h.createHref({ pathname: '' }, { prependBasePath: false })).toEqual(`/`);
expect(
h.createHref({ pathname: '/new-page', search: '?alpha=true' }, { prependBasePath: false })
).toEqual(`/new-page?alpha=true`);
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/core/public/application/scoped_history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class ScopedHistory<HistoryLocationState = unknown>
*/
public createHref = (
location: LocationDescriptorObject<HistoryLocationState>,
prependBasePath: boolean = true
{ prependBasePath = true }: { prependBasePath?: boolean } = {}
): Href => {
this.verifyActive();
if (prependBasePath) {
Expand Down

0 comments on commit 353277d

Please sign in to comment.