feat: person @mentions edit-mode infrastructure (PR-B1, #362) #369
@@ -42,6 +42,18 @@ describe('detectPersonMention', () => {
|
||||
expect(detectPersonMention('@Aug@bar', 8)).toBeNull();
|
||||
});
|
||||
|
||||
it('uses the most recent @ when separated by whitespace', () => {
|
||||
// '@Aug @Bert' with cursor at end — the second @ is the trigger.
|
||||
expect(detectPersonMention('@Aug @Bert', 10)).toBe('Bert');
|
||||
});
|
||||
|
||||
it('returns the query when the cursor sits exactly at a newline boundary', () => {
|
||||
// '@Aug\nfoo' with cursor at index 4 — right at the newline before it
|
||||
// is consumed. The query is still 'Aug' because nothing past the cursor
|
||||
// counts.
|
||||
expect(detectPersonMention('@Aug\nfoo', 4)).toBe('Aug');
|
||||
});
|
||||
|
||||
it('returns null when cursor is before the @', () => {
|
||||
expect(detectPersonMention('@Hans', 0)).toBeNull();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user