Change quick add magic characters to be more familiar with the todoist ones

This commit is contained in:
kolaente 2021-07-06 14:53:32 +02:00
parent e63dbdd625
commit f68794bd01
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 21 additions and 21 deletions

View file

@ -13,13 +13,13 @@
<h3>{{ $t('task.attributes.labels') }}</h3>
<p>
{{ $t('task.quickAddMagic.label1', {prefix: '~'}) }}
{{ $t('task.quickAddMagic.label1', {prefix: '@'}) }}
{{ $t('task.quickAddMagic.label2') }}
{{ $t('task.quickAddMagic.multiple') }}
</p>
<p>
{{ $t('task.quickAddMagic.label3') }}
{{ $t('task.quickAddMagic.label4', {prefix: '~'}) }}
{{ $t('task.quickAddMagic.label4', {prefix: '@'}) }}
</p>
<h3>{{ $t('task.attributes.priority') }}</h3>
@ -36,7 +36,7 @@
<h3>{{ $t('list.list.title') }}</h3>
<p>
{{ $t('task.quickAddMagic.list1', {prefix: '*'}) }}
{{ $t('task.quickAddMagic.list1', {prefix: '#'}) }}
{{ $t('task.quickAddMagic.list2') }}
</p>

View file

@ -1,10 +1,10 @@
import {parseDate} from './time/parseDate'
import priorities from '../models/priorities.json'
const LABEL_PREFIX = '~'
const LIST_PREFIX = '*'
const LABEL_PREFIX = '@'
const LIST_PREFIX = '#'
const PRIORITY_PREFIX = '!'
const ASSIGNEE_PREFIX = '@'
const ASSIGNEE_PREFIX = '+'
/**
* Parses task text for dates, assignees, labels, lists, priorities and returns an object with all found intents.

View file

@ -277,7 +277,7 @@ describe('Parse Task Text', () => {
describe('Labels', () => {
it('should parse labels', () => {
const result = parseTaskText('Lorem Ipsum ~label1 ~label2')
const result = parseTaskText('Lorem Ipsum @label1 @label2')
expect(result.text).toBe('Lorem Ipsum')
expect(result.labels).toHaveLength(2)
@ -285,7 +285,7 @@ describe('Parse Task Text', () => {
expect(result.labels[1]).toBe('label2')
})
it('should parse labels from the start', () => {
const result = parseTaskText('~label1 Lorem Ipsum ~label2')
const result = parseTaskText('@label1 Lorem Ipsum @label2')
expect(result.text).toBe('Lorem Ipsum')
expect(result.labels).toHaveLength(2)
@ -293,7 +293,7 @@ describe('Parse Task Text', () => {
expect(result.labels[1]).toBe('label2')
})
it('should resolve duplicate labels', () => {
const result = parseTaskText('Lorem Ipsum ~label1 ~label1 ~label2')
const result = parseTaskText('Lorem Ipsum @label1 @label1 @label2')
expect(result.text).toBe('Lorem Ipsum')
expect(result.labels).toHaveLength(2)
@ -301,14 +301,14 @@ describe('Parse Task Text', () => {
expect(result.labels[1]).toBe('label2')
})
it('should correctly parse labels with spaces in them', () => {
const result = parseTaskText(`Lorem ~'label with space' Ipsum`)
const result = parseTaskText(`Lorem @'label with space' Ipsum`)
expect(result.text).toBe('Lorem Ipsum')
expect(result.labels).toHaveLength(1)
expect(result.labels[0]).toBe('label with space')
})
it('should correctly parse labels with spaces in them and "', () => {
const result = parseTaskText('Lorem ~"label with space" Ipsum')
const result = parseTaskText('Lorem @"label with space" Ipsum')
expect(result.text).toBe('Lorem Ipsum')
expect(result.labels).toHaveLength(1)
@ -318,27 +318,27 @@ describe('Parse Task Text', () => {
describe('List', () => {
it('should parse a list', () => {
const result = parseTaskText('Lorem Ipsum *list')
const result = parseTaskText('Lorem Ipsum #list')
expect(result.text).toBe('Lorem Ipsum')
expect(result.list).toBe('list')
})
it('should parse a list with a space in it', () => {
const result = parseTaskText(`Lorem Ipsum *'list with long name'`)
const result = parseTaskText(`Lorem Ipsum #'list with long name'`)
expect(result.text).toBe('Lorem Ipsum')
expect(result.list).toBe('list with long name')
})
it('should parse a list with a space in it and "', () => {
const result = parseTaskText(`Lorem Ipsum *"list with long name"`)
const result = parseTaskText(`Lorem Ipsum #"list with long name"`)
expect(result.text).toBe('Lorem Ipsum')
expect(result.list).toBe('list with long name')
})
it('should parse only the first list', () => {
const result = parseTaskText(`Lorem Ipsum *list1 *list2 *list3`)
const result = parseTaskText(`Lorem Ipsum #list1 #list2 #list3`)
expect(result.text).toBe('Lorem Ipsum *list2 *list3')
expect(result.text).toBe('Lorem Ipsum #list2 #list3')
expect(result.list).toBe('list1')
})
})
@ -368,14 +368,14 @@ describe('Parse Task Text', () => {
describe('Assignee', () => {
it('should parse an assignee', () => {
const result = parseTaskText('Lorem Ipsum @user')
const result = parseTaskText('Lorem Ipsum +user')
expect(result.text).toBe('Lorem Ipsum')
expect(result.assignees).toHaveLength(1)
expect(result.assignees[0]).toBe('user')
})
it('should parse multiple assignees', () => {
const result = parseTaskText('Lorem Ipsum @user1 @user2 @user3')
const result = parseTaskText('Lorem Ipsum +user1 +user2 +user3')
expect(result.text).toBe('Lorem Ipsum')
expect(result.assignees).toHaveLength(3)
@ -384,7 +384,7 @@ describe('Parse Task Text', () => {
expect(result.assignees[2]).toBe('user3')
})
it('should parse avoid duplicate assignees', () => {
const result = parseTaskText('Lorem Ipsum @user1 @user1 @user2')
const result = parseTaskText('Lorem Ipsum +user1 +user1 +user2')
expect(result.text).toBe('Lorem Ipsum')
expect(result.assignees).toHaveLength(2)
@ -392,14 +392,14 @@ describe('Parse Task Text', () => {
expect(result.assignees[1]).toBe('user2')
})
it('should parse an assignee with a space in it', () => {
const result = parseTaskText(`Lorem Ipsum @'user with long name'`)
const result = parseTaskText(`Lorem Ipsum +'user with long name'`)
expect(result.text).toBe('Lorem Ipsum')
expect(result.assignees).toHaveLength(1)
expect(result.assignees[0]).toBe('user with long name')
})
it('should parse an assignee with a space in it and "', () => {
const result = parseTaskText(`Lorem Ipsum @"user with long name"`)
const result = parseTaskText(`Lorem Ipsum +"user with long name"`)
expect(result.text).toBe('Lorem Ipsum')
expect(result.assignees).toHaveLength(1)