feat: Make it easier to handle multiple tags
- Tags can now be removed straight from the email header - Tagging control now allows the user to (de)select multiple tags in one go
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
getThreadParticipants,
|
||||
mergeThreadEmails,
|
||||
getEmailTagId,
|
||||
getEmailTagIds,
|
||||
getThreadTagId,
|
||||
getThreadTagIds,
|
||||
} from '../thread-utils';
|
||||
@@ -246,6 +247,30 @@ describe('mergeThreadEmails', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getEmailTagIds', () => {
|
||||
it('gathers every tag set on the message', () => {
|
||||
expect(getEmailTagIds({ '$label:red': true, '$label:work': true, $seen: true }))
|
||||
.toEqual(['red', 'work']);
|
||||
});
|
||||
|
||||
it('reads the legacy prefix alongside the current one', () => {
|
||||
expect(getEmailTagIds({ '$label:red': true, '$color:blue': true })).toEqual(['red', 'blue']);
|
||||
});
|
||||
|
||||
it('reports a tag written under both prefixes once', () => {
|
||||
expect(getEmailTagIds({ '$label:red': true, '$color:red': true })).toEqual(['red']);
|
||||
});
|
||||
|
||||
it('ignores keywords set to false', () => {
|
||||
expect(getEmailTagIds({ '$label:red': false, '$label:work': true })).toEqual(['work']);
|
||||
});
|
||||
|
||||
it('is empty for an untagged message or none at all', () => {
|
||||
expect(getEmailTagIds({ $seen: true })).toEqual([]);
|
||||
expect(getEmailTagIds(undefined)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getEmailTagId', () => {
|
||||
it('returns label from $label: keyword', () => {
|
||||
expect(getEmailTagId({ '$label:red': true, $seen: true })).toBe('red');
|
||||
|
||||
Reference in New Issue
Block a user