Skip to content

Commit

Permalink
Merge branch 'w2p-110878_Entity-search-tabs-clear-params-7.6' into w2…
Browse files Browse the repository at this point in the history
…p-110878_Entity-search-tabs-clear-params-7_x
  • Loading branch information
Atmire-Kristof committed Jan 17, 2024
2 parents ac0e745 + a7a5292 commit 5c11728
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {

if (typeof params.startsWith === 'string'){
this.startsWith = params.startsWith.trim();
} else {
this.startsWith = '';
}

if (isNotEmpty(this.value)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="d-flex flex-row">
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" [attr.rel]="(linkType == linkTypes.ExternalLink) ? 'noopener noreferrer' : null" [routerLink]="[]" [queryParams]="queryParams$ | async" [queryParamsHandling]="'merge'" class="lead">
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" [attr.rel]="(linkType == linkTypes.ExternalLink) ? 'noopener noreferrer' : null" [routerLink]="[]" [queryParams]="queryParams$ | async" class="lead">
{{object.value}}
</a>
<span *ngIf="linkType == linkTypes.None" class="lead">
Expand Down
3 changes: 1 addition & 2 deletions src/app/shared/starts-with/starts-with-abstract.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ export abstract class StartsWithAbstractComponent implements OnInit, OnDestroy {
this.startsWith = undefined;
}
if (resetPage) {
this.paginationService.updateRoute(this.paginationId, {page: 1}, { startsWith: this.startsWith });
this.paginationService.updateRoute(this.paginationId, {page: 1}, { startsWith: this.startsWith }, undefined, { queryParamsHandling: '' });
} else {
this.router.navigate([], {
queryParams: Object.assign({ startsWith: this.startsWith }),
queryParamsHandling: 'merge'
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { StartsWithTextComponent } from './starts-with-text.component';
import { PaginationService } from '../../../core/pagination/pagination.service';
import { PaginationServiceStub } from '../../testing/pagination-service.stub';

describe('StartsWithTextComponent', () => {
fdescribe('StartsWithTextComponent', () => {
let comp: StartsWithTextComponent;
let fixture: ComponentFixture<StartsWithTextComponent>;
let route: ActivatedRoute;
Expand Down Expand Up @@ -62,8 +62,8 @@ describe('StartsWithTextComponent', () => {
expect(comp.startsWith).toEqual(expectedValue);
});

it('should add a startsWith query parameter', () => {
expect(paginationService.updateRoute).toHaveBeenCalledWith('page-id', {page: 1}, {startsWith: expectedValue});
it('should add a startsWith query parameter and clear all others', () => {
expect(paginationService.updateRoute).toHaveBeenCalledWith('page-id', {page: 1}, {startsWith: expectedValue}, undefined, { queryParamsHandling: '' });
});
});

Expand Down

0 comments on commit 5c11728

Please sign in to comment.