Fix task pagination
This commit is contained in:
parent
d441751c5b
commit
2bf5ffa1a1
3 changed files with 28 additions and 0 deletions
|
@ -117,6 +117,29 @@ describe('Lists', () => {
|
||||||
cy.get('.tasks-container .tasks .color-bubble')
|
cy.get('.tasks-container .tasks .color-bubble')
|
||||||
.should('not.exist')
|
.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', () => {
|
describe('Table View', () => {
|
||||||
|
|
|
@ -27,6 +27,10 @@ export class Factory {
|
||||||
for (let i = 1; i <= count; i++) {
|
for (let i = 1; i <= count; i++) {
|
||||||
const entry = merge(this.factory(), override)
|
const entry = merge(this.factory(), override)
|
||||||
for (const e in entry) {
|
for (const e in entry) {
|
||||||
|
if(typeof entry[e] === 'function') {
|
||||||
|
entry[e] = entry[e](i)
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (entry[e] === '{increment}') {
|
if (entry[e] === '{increment}') {
|
||||||
entry[e] = i
|
entry[e] = i
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ export default {
|
||||||
id: list.listId,
|
id: list.listId,
|
||||||
params: params,
|
params: params,
|
||||||
search: search,
|
search: search,
|
||||||
|
page: page,
|
||||||
}
|
}
|
||||||
if (JSON.stringify(currentList) === JSON.stringify(this.loadedList)) {
|
if (JSON.stringify(currentList) === JSON.stringify(this.loadedList)) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue