Test that open tasks are always shown in week view

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-11-14 09:35:28 +01:00
parent c8c6feed75
commit d10f532d3d
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178
2 changed files with 54 additions and 3 deletions

View file

@ -71,4 +71,42 @@ describe('Week.vue', () => {
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz37g.ics"]').exists()).toBe(true) // Shown now, because parent is active
expect(wrapper.find('div[day="2"] li[task-id="pwen2kz37g.ics"]').exists()).toBe(false) // Not shown, since parent is not active
})
it('Checks that an active task and its ancestors are shown', () => {
const wrapper = mount(Week, { localVue, store, router })
let taskAtDay0 = wrapper.find('div[day="0"] li[task-id="pwen8kz22g.ics"] > div')
if (wrapper.vm.$route.params.taskId !== null) {
router.push({ name: 'collections', params: { collectionId: 'week' } })
}
expect(taskAtDay0.classes('active')).toBe(false)
expect(wrapper.find('div[day="0"] li[task-id="pwen8kz22g.ics"]').exists()).toBe(true) // Shown, since it is due today
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz37g.ics"]').exists()).toBe(false) // Not shown, since it is only due in a month
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz38g.ics"]').exists()).toBe(false) // Not shown, since it is not due at all
// Click on first task to open it
taskAtDay0.trigger('click')
expect(taskAtDay0.classes('active')).toBe(true)
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz37g.ics"]').exists()).toBe(true) // Shown now, since parent is active
expect(wrapper.find('div[day="0"] li[task-id="pwen7kz22g.ics"]').exists()).toBe(true) // Shown now, since parent is active
let subtaskAtDay0 = wrapper.find('div[day="0"] li[task-id="pwen2kz37g.ics"] > div')
// Click on subtask to open it
subtaskAtDay0.trigger('click')
expect(subtaskAtDay0.classes('active')).toBe(true)
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz38g.ics"]').exists()).toBe(true) // Shown now, since parent is active
expect(wrapper.find('div[day="0"] li[task-id="pwen7kz22g.ics"]').exists()).toBe(false) // Not shown, since only sibling is active
let subsubtaskAtDay0 = wrapper.find('div[day="0"] li[task-id="pwen2kz38g.ics"] > div')
// Click on subtask to open it
subsubtaskAtDay0.trigger('click')
expect(subsubtaskAtDay0.classes('active')).toBe(true)
expect(wrapper.find('div[day="0"] li[task-id="pwen8kz22g.ics"]').exists()).toBe(true) // Shown, since it is due today
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz37g.ics"]').exists()).toBe(true) // Shown, since child is active
expect(wrapper.find('div[day="0"] li[task-id="pwen2kz38g.ics"]').exists()).toBe(true) // Shown, since it is active
})
})

View file

@ -229,7 +229,7 @@ CREATED:20171119T183919\n
DTSTAMP:20180918T095816\n
LAST-MODIFIED:20190918T095816\n
UID:pwen8kz22g\n
SUMMARY:Calendar 2 - Task 3\n
SUMMARY:Calendar 2 - Task 4\n
DUE:20190101T120000\n
END:VTODO\n
END:VCALENDAR`,
@ -243,7 +243,7 @@ DTSTAMP:20180918T095816\n
LAST-MODIFIED:20190918T095816\n
RELATED-TO:pwen8kz22g\n
UID:pwen7kz22g\n
SUMMARY:Calendar 2 - Task 3\n
SUMMARY:Calendar 2 - Task 4 - Subtask 1\n
DUE:20190103T120000\n
END:VTODO\n
END:VCALENDAR`,
@ -257,9 +257,22 @@ DTSTAMP:20180918T095816\n
LAST-MODIFIED:20190918T095816\n
RELATED-TO:pwen8kz22g\n
UID:pwen2kz37g\n
SUMMARY:Calendar 2 - Task 3\n
SUMMARY:Calendar 2 - Task 4 - Subtask 2\n
DUE:20190203T120000\n
END:VTODO\n
END:VCALENDAR`,
`
BEGIN:VCALENDAR\n
VERSION:2.0\n
PRODID:-//Nextcloud Tasks 0.11.3\n
BEGIN:VTODO\n
CREATED:20171119T183919\n
DTSTAMP:20180918T095816\n
LAST-MODIFIED:20190918T095816\n
RELATED-TO:pwen2kz37g\n
UID:pwen2kz38g\n
SUMMARY:Calendar 2 - Task 4 - Subtask 2 - Subsubtask 1\n
END:VTODO\n
END:VCALENDAR`
],
},