diff options
author | Raimund Schlüßler <raimund.schluessler@mailbox.org> | 2019-11-07 23:03:44 +0300 |
---|---|---|
committer | Raimund Schlüßler <raimund.schluessler@mailbox.org> | 2019-11-07 23:03:44 +0300 |
commit | 10e773a7a216f64149dd5e035aefb2b564c6b064 (patch) | |
tree | b1360c8429b2d31178a7010612571f5ec251c88d /tests | |
parent | b33a08f6d34f7973f44f379608908b19369864d7 (diff) |
Add simple test for week view
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/javascript/unit/components/TheCollections/Week.spec.js | 35 | ||||
-rw-r--r-- | tests/javascript/unit/setupStore.js | 18 |
2 files changed, 52 insertions, 1 deletions
diff --git a/tests/javascript/unit/components/TheCollections/Week.spec.js b/tests/javascript/unit/components/TheCollections/Week.spec.js new file mode 100644 index 00000000..53110773 --- /dev/null +++ b/tests/javascript/unit/components/TheCollections/Week.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import Week from '../../../../../src/components/TheCollections/Week' +import router from '../../../../../src/components/TheRouter' + +import { store, localVue } from '../../setupStore' + +import VTooltip from 'v-tooltip' +localVue.use(VTooltip) + +describe('Week.vue', () => { + 'use strict' + + it('Checks that the correct tasks are shown for day 0 (today)', () => { + const wrapper = mount(Week, { localVue, store, router }) + expect(wrapper.find('div[day="0"] li[task-id="pwen4kz18g.ics"]').exists()).toBe(true) // Was due today --> shown + expect(wrapper.find('div[day="0"] li[task-id="pwen4kz20g.ics"]').exists()).toBe(true) // Has a due subtask --> shown + expect(wrapper.find('div[day="0"] li[task-id="pwen4kz23g.ics"]').exists()).toBe(true) // Due subtask --> shown + expect(wrapper.find('div[day="0"] li[task-id="pwen4kz25g.ics"]').exists()).toBe(false) // Start date in future --> hidden + }) + + it('Checks that the correct tasks are shown for day 1 (tomorrow)', () => { + const wrapper = mount(Week, { localVue, store, router }) + expect(wrapper.find('div[day="1"] li[task-id="pwen4kz41g.ics"]').exists()).toBe(true) // Starts tomorrow --> shown + }) + + it('Checks that the correct tasks are shown for day 2 (day after tomorrow)', () => { + const wrapper = mount(Week, { localVue, store, router }) + expect(wrapper.find('div[day="2"] li[task-id="pwen4kz21g.ics"]').exists()).toBe(true) // Start the day after tomorrow --> shown + }) + + it('Checks that the correct tasks are shown for day 6', () => { + const wrapper = mount(Week, { localVue, store, router }) + expect(wrapper.find('div[day="6"] li[task-id="pwen4kz22g.ics"]').exists()).toBe(true) // Starts in 7 days --> shown + }) +}) diff --git a/tests/javascript/unit/setupStore.js b/tests/javascript/unit/setupStore.js index 9d398285..fa6d71dd 100644 --- a/tests/javascript/unit/setupStore.js +++ b/tests/javascript/unit/setupStore.js @@ -150,13 +150,27 @@ CREATED:20181119T183919\n DTSTAMP:20190918T095816\n LAST-MODIFIED:20190918T095816\n UID:pwen4kz40g\n -SUMMARY:Calendar 1 - Task 2\n +SUMMARY:Calendar 1 - Task 5\n PRIORITY:9\n PERCENT-COMPLETE:100\n STATUS:COMPLETED\n COMPLETED:20190918T095816\n DTSTART:20190918T095816\n END:VTODO\n +END:VCALENDAR`, +` +BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Nextcloud Tasks 0.11.3\n +BEGIN:VTODO\n +CREATED:20181119T183919\n +DTSTAMP:20190918T095816\n +LAST-MODIFIED:20190918T095816\n +UID:pwen4kz41g\n +SUMMARY:Calendar 1 - Task 6\n +PRIORITY:9\n +DTSTART:20190102T095816\n +END:VTODO\n END:VCALENDAR` ], }, @@ -177,6 +191,7 @@ DTSTAMP:20190918T095816\n LAST-MODIFIED:20190918T095816\n UID:pwen4kz21g\n SUMMARY:Calendar 2 - Task 1\n +DUE:20190103T120000\n END:VTODO\n END:VCALENDAR`, ` @@ -189,6 +204,7 @@ DTSTAMP:20190918T095816\n LAST-MODIFIED:20190918T095816\n UID:pwen4kz22g\n SUMMARY:Calendar 2 - Task 2\n +DUE:20190107T120000\n END:VTODO\n END:VCALENDAR` ], |