Skip to content

Commit

Permalink
[Share] The redirect app path should not appear in the browser history (
Browse files Browse the repository at this point in the history
elastic#117155)

* the redirect app path should not appear in the browser history

* updated jest test to also expect replace

* added comment

* update jest test
  • Loading branch information
jloleysens committed Nov 3, 2021
1 parent e612a34 commit fe50968
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ describe('on page mount', () => {
})
)}`
);
expect(spy).toHaveBeenCalledWith({
foo: 'bar',
});
expect(spy).toHaveBeenCalledWith(
{
foo: 'bar',
},
{ replace: true }
);
});

test('migrates parameters on-the-fly to the latest version', async () => {
Expand All @@ -73,9 +76,12 @@ describe('on page mount', () => {
})
)}`
);
expect(spy).toHaveBeenCalledWith({
num: 2,
});
expect(spy).toHaveBeenCalledWith(
{
num: 2,
},
{ replace: true }
);
});

test('throws if locator does not exist', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export class RedirectManager {
});

locator
.navigate(migratedParams)
.navigate(migratedParams, {
replace: true, // We do not want the redirect app URL to appear in browser navigation history
})
.then()
.catch((error) => {
// eslint-disable-next-line no-console
Expand Down

0 comments on commit fe50968

Please sign in to comment.