1
0

site search should not adopt existing URL query string parameters (#2818)

src/app/search-navbar: do not merge existing query params

Do not merge existing query params when using site search from MyDSpace workflow.
This commit is contained in:
Sascha Szott
2024-02-22 09:10:02 +01:00
committed by GitHub
parent 32bac12bbd
commit d5aca7633c
2 changed files with 3 additions and 4 deletions

View File

@@ -88,7 +88,7 @@ describe('SearchNavbarComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('to search page with empty query', () => { it('to search page with empty query', () => {
const extras: NavigationExtras = { queryParams: { query: '' }, queryParamsHandling: 'merge' }; const extras: NavigationExtras = { queryParams: { query: '' } };
expect(component.onSubmit).toHaveBeenCalledWith({ query: '' }); expect(component.onSubmit).toHaveBeenCalledWith({ query: '' });
expect(router.navigate).toHaveBeenCalledWith(['search'], extras); expect(router.navigate).toHaveBeenCalledWith(['search'], extras);
}); });
@@ -113,7 +113,7 @@ describe('SearchNavbarComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('to search page with query', async () => { it('to search page with query', async () => {
const extras: NavigationExtras = { queryParams: { query: 'test' }, queryParamsHandling: 'merge' }; const extras: NavigationExtras = { queryParams: { query: 'test' } };
expect(component.onSubmit).toHaveBeenCalledWith({ query: 'test' }); expect(component.onSubmit).toHaveBeenCalledWith({ query: 'test' });
expect(router.navigate).toHaveBeenCalledWith(['search'], extras); expect(router.navigate).toHaveBeenCalledWith(['search'], extras);

View File

@@ -66,8 +66,7 @@ export class SearchNavbarComponent {
this.searchForm.reset(); this.searchForm.reset();
this.router.navigate(linkToNavigateTo, { this.router.navigate(linkToNavigateTo, {
queryParams: queryParams, queryParams: queryParams
queryParamsHandling: 'merge'
}); });
} }
} }