diff --git a/tests/javascript/unit/components/TheCollections/Week.spec.js b/tests/javascript/unit/components/TheCollections/Week.spec.js index 204bb069..c8b11892 100644 --- a/tests/javascript/unit/components/TheCollections/Week.spec.js +++ b/tests/javascript/unit/components/TheCollections/Week.spec.js @@ -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 + }) }) diff --git a/tests/javascript/unit/setupStore.js b/tests/javascript/unit/setupStore.js index 955c2290..f2c90e31 100644 --- a/tests/javascript/unit/setupStore.js +++ b/tests/javascript/unit/setupStore.js @@ -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` ], },