Skip to content

Commit

Permalink
fix: wrong copy files results
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Jan 9, 2024
1 parent 15dee44 commit 7dc6ec2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/pagination.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"results": "{{start}} to {{end}} of {{total}} {{item}}s",
"results_one": "1 {{item}}",
"results_other": "{{start}} to {{end}} of {{count}} {{item}}s",
"pageSize": "{{item}}s per page"
}
4 changes: 2 additions & 2 deletions src/sections/shared/pagination/PaginationResultsInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function PaginationResultsInfo({ paginationInfo }: PaginationResultsInfoP
{t('results', {
start: paginationInfo.pageStartItem,
end: paginationInfo.pageEndItem,
total: paginationInfo.totalItems,
item: paginationInfo.itemName
item: paginationInfo.itemName,
count: paginationInfo.totalItems
})}
</span>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { FilePaginationInfo } from '../../../../../src/files/domain/models/FilePaginationInfo'
import { DatasetPaginationInfo } from '../../../../../src/dataset/domain/models/DatasetPaginationInfo'
import { PaginationResultsInfo } from '../../../../../src/sections/shared/pagination/PaginationResultsInfo'
import { PaginationInfo } from '../../../../../src/shared/domain/models/PaginationInfo'

describe('PaginationResultsInfo', () => {
it('shows the correct results info', () => {
cy.customMount(
<PaginationResultsInfo
paginationInfo={new PaginationInfo<FilePaginationInfo | DatasetPaginationInfo>(1, 10, 11)}
/>
)

cy.findByText('1 to 10 of 11 Items').should('exist')
})

it('shows the correct results info when there is 1 item', () => {
cy.customMount(
<PaginationResultsInfo
paginationInfo={new PaginationInfo<FilePaginationInfo | DatasetPaginationInfo>(1, 10, 1)}
/>
)

cy.findByText('1 Item').should('exist')
})
})

0 comments on commit 7dc6ec2

Please sign in to comment.