Fix task pagination

This commit is contained in:
kolaente 2021-02-20 17:10:56 +01:00
parent d441751c5b
commit 2bf5ffa1a1
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 28 additions and 0 deletions

View File

@ -117,6 +117,29 @@ describe('Lists', () => {
cy.get('.tasks-container .tasks .color-bubble')
.should('not.exist')
})
it('Should paginate for > 50 tasks', () => {
const tasks = TaskFactory.create(100, {
id: '{increment}',
title: i => `task${i}`,
list_id: 1,
})
cy.visit('/lists/1/list')
cy.get('.tasks-container .tasks')
.should('contain', tasks[99].title)
cy.get('.card-content .pagination .pagination-link')
.contains('2')
.click()
cy.url()
.should('contain', '?page=2')
cy.get('.tasks-container .tasks')
.should('contain', tasks[1].title)
cy.get('.tasks-container .tasks')
.should('not.contain', tasks[99].title)
})
})
describe('Table View', () => {

View File

@ -27,6 +27,10 @@ export class Factory {
for (let i = 1; i <= count; i++) {
const entry = merge(this.factory(), override)
for (const e in entry) {
if(typeof entry[e] === 'function') {
entry[e] = entry[e](i)
continue
}
if (entry[e] === '{increment}') {
entry[e] = i
}

View File

@ -70,6 +70,7 @@ export default {
id: list.listId,
params: params,
search: search,
page: page,
}
if (JSON.stringify(currentList) === JSON.stringify(this.loadedList)) {
return