Compare commits

..

2 Commits

Author SHA1 Message Date
c986759436
fix: lint 2022-01-08 15:23:33 +01:00
316b147517
fix: don't recognize emails in quick add magic 2022-01-08 15:06:52 +01:00
7 changed files with 26 additions and 14 deletions

View File

@ -128,7 +128,7 @@ describe('Task', () => {
cy.visit(`/tasks/${tasks[0].id}`)
cy.get('.task-view .action-buttons .button')
.contains('Mark task done!')
.contains('Done!')
.click()
cy.get('.task-view .heading .is-done')

View File

@ -13,6 +13,7 @@
"lint": "eslint --ignore-pattern '*.test.*' ./src --ext .vue,.js,.ts",
"cypress:open": "cypress open",
"test:unit": "vitest run",
"test:unit-watch": "vitest watch",
"test:frontend": "cypress run",
"browserslist:update": "npx browserslist@latest --update-db"
},

View File

@ -348,10 +348,6 @@ $editor-border-color: #ddd;
color: var(--grey-400) !important;
font-style: italic;
}
&-cursor {
border-color: var(--grey-700);
}
}
.editor-preview {

View File

@ -545,7 +545,7 @@
"chooseStartDate": "Click here to set a start date",
"chooseEndDate": "Click here to set an end date",
"move": "Move task to a different list",
"done": "Mark task done!",
"done": "Done!",
"undone": "Mark as undone",
"created": "Created {0} by {1}",
"updated": "Updated {0}",
@ -781,7 +781,7 @@
"then": "then",
"task": {
"title": "Task Page",
"done": "Done",
"done": "Mark a task as done",
"assign": "Assign to a user",
"labels": "Add labels to this task",
"dueDate": "Change the due date of this task",

View File

@ -32,6 +32,13 @@ describe('Parse Task Text', () => {
expect(result.assignees).toHaveLength(1)
expect(result.assignees[0]).toBe('user')
})
it('should ignore email addresses', () => {
const text = 'Lorem Ipsum email@example.com'
const result = parseTaskText(text)
expect(result.text).toBe(text)
})
describe('Date Parsing', () => {
it('should not return any date if none was provided', () => {

View File

@ -117,23 +117,30 @@ export const parseTaskText = (text: string, prefixesMode: PrefixMode = PrefixMod
const getItemsFromPrefix = (text: string, prefix: string): string[] => {
const items: string[] = []
const itemParts = text.split(prefix)
const itemParts = text.split(' ' + prefix)
if (text.startsWith(prefix)) {
const firstItem = text.split(prefix)[1]
itemParts.unshift(firstItem)
}
itemParts.forEach((p, index) => {
// First part contains the rest
if (index < 1) {
return
}
let labelText
p = p.replace(prefix, '')
let itemText
if (p.charAt(0) === '\'') {
labelText = p.split('\'')[1]
itemText = p.split('\'')[1]
} else if (p.charAt(0) === '"') {
labelText = p.split('"')[1]
itemText = p.split('"')[1]
} else {
// Only until the next space
labelText = p.split(' ')[0]
itemText = p.split(' ')[0]
}
items.push(labelText)
items.push(itemText)
})
return Array.from(new Set(items))

View File

@ -627,6 +627,7 @@ export default {
}
this.task = await this.$store.dispatch('tasks/update', this.task)
this.setActiveFields()
if (!showNotification) {
return
@ -870,7 +871,7 @@ $flash-background-duration: 750ms;
}
.action-buttons {
.button {
a.button {
width: 100%;
margin-bottom: .5rem;
justify-content: left;