Add simple test for week view
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
b33a08f6d3
commit
10e773a7a2
3 changed files with 55 additions and 2 deletions
|
@ -24,7 +24,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
<div>
|
||||
<SortorderDropdown />
|
||||
<div class="task-list">
|
||||
<div v-for="day in days" :key="day.diff" class="grouped-tasks ui-droppable">
|
||||
<div v-for="day in days" :key="day.diff" :day="day.diff"
|
||||
class="grouped-tasks ui-droppable"
|
||||
>
|
||||
<h2 class="heading">
|
||||
{{ day.diff | formatDay }}
|
||||
</h2>
|
||||
|
|
35
tests/javascript/unit/components/TheCollections/Week.spec.js
Normal file
35
tests/javascript/unit/components/TheCollections/Week.spec.js
Normal file
|
@ -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
|
||||
})
|
||||
})
|
|
@ -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`
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue