Skip to content

Commit

Permalink
Merge pull request #753 from geonetwork/org-search-paginate
Browse files Browse the repository at this point in the history
Datahub: Fix organisation search to work with pagination
  • Loading branch information
tkohr authored Jan 9, 2024
2 parents 3632b8b + fb45908 commit 5281d0d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apps/datahub-e2e/src/e2e/organizations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class OrganisationsComponent {
}

protected setFilterBy(value: string): void {
this.currentPage$.next(1)
this.filterBy$.next(value)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<div class="max-h-24 overflow-hidden text-ellipsis">
<p
class="font-title font-medium text-21 text-black break-words pb-1 line-clamp-2"
class="font-title font-medium text-21 text-black break-words mb-1 line-clamp-2"
>
{{ link.name }}
</p>
Expand Down

0 comments on commit 5281d0d

Please sign in to comment.