diff --git a/apps/datahub-e2e/src/e2e/organizations.cy.ts b/apps/datahub-e2e/src/e2e/organizations.cy.ts index 7a5e521697..f9f0d19ffe 100644 --- a/apps/datahub-e2e/src/e2e/organizations.cy.ts +++ b/apps/datahub-e2e/src/e2e/organizations.cy.ts @@ -173,5 +173,15 @@ describe('organizations', () => { cy.get('@organisationsSearch').type('An organisation that does not exist') cy.get('@organisationsResult').should('contain', 'No organizations found') }) + it('should display filtered results after navigation to second page', () => { + cy.get('@pagination').children('div').first().find('gn-ui-button').click() + cy.get('@organisationsSearch').type('geo2france') + cy.get('@organizationsName').should('have.length', 1) + cy.get('@organisationsResult').should('contain', '1') + cy.get('@organizationsName') + .eq(0) + .invoke('text') + .should('contain', 'Géo2France') + }) }) }) diff --git a/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts b/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts index b115c8f8d7..582016fe91 100644 --- a/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts +++ b/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts @@ -162,6 +162,16 @@ describe('OrganisationsComponent', () => { .name ).toEqual('J Data Org') }) + it('should not change currentPage when sorting results', () => { + component.setSortBy('desc') + fixture.detectChanges() + expect(paginationComponentDE.componentInstance.currentPage).toEqual(2) + }) + it('should set currentPage to 1 when filtering to display results', () => { + component.setFilterBy('Data') + fixture.detectChanges() + expect(paginationComponentDE.componentInstance.currentPage).toEqual(1) + }) }) }) describe('sort by recordCount', () => { diff --git a/libs/feature/catalog/src/lib/organisations/organisations.component.ts b/libs/feature/catalog/src/lib/organisations/organisations.component.ts index ecfc0418bb..a6be8656d6 100644 --- a/libs/feature/catalog/src/lib/organisations/organisations.component.ts +++ b/libs/feature/catalog/src/lib/organisations/organisations.component.ts @@ -74,6 +74,7 @@ export class OrganisationsComponent { } protected setFilterBy(value: string): void { + this.currentPage$.next(1) this.filterBy$.next(value) } diff --git a/libs/ui/elements/src/lib/link-card/link-card.component.html b/libs/ui/elements/src/lib/link-card/link-card.component.html index 28213baca9..8f87410c66 100644 --- a/libs/ui/elements/src/lib/link-card/link-card.component.html +++ b/libs/ui/elements/src/lib/link-card/link-card.component.html @@ -5,7 +5,7 @@ >
{{ link.name }}