Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datahub: Fix organisation search to work with pagination #753

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading