Allow to remove status property
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
706834328d
commit
07a41ddb40
|
@ -336,14 +336,18 @@ export default class Task {
|
|||
} else if (this.complete === 0) {
|
||||
this.setComplete(1)
|
||||
}
|
||||
} else if (status === 'NEEDS-ACTION') {
|
||||
} else if (status === 'NEEDS-ACTION' || status === null) {
|
||||
this.setComplete(0)
|
||||
this.setCompleted(false)
|
||||
}
|
||||
}
|
||||
|
||||
setStatus(status) {
|
||||
this.vtodo.updatePropertyWithValue('status', status)
|
||||
if (status === null) {
|
||||
this.vtodo.removeProperty('status')
|
||||
} else {
|
||||
this.vtodo.updatePropertyWithValue('status', status)
|
||||
}
|
||||
this.updateLastModified()
|
||||
this._status = this.vtodo.getFirstPropertyValue('status')
|
||||
}
|
||||
|
|
|
@ -204,4 +204,12 @@ describe('task', () => {
|
|||
task.categories = []
|
||||
expect(task.categories.length).toEqual(0)
|
||||
})
|
||||
|
||||
it('Should remove status property when set to null', () => {
|
||||
const task = new Task(loadICS('vcalendars/vcalendar-default'), {})
|
||||
task.status = null
|
||||
// Check that status gets removed instead of being set to zero
|
||||
const complete = task.vtodo.getFirstPropertyValue('status')
|
||||
expect(complete).toEqual(null)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue