v0.2.0: bubble for Android 0.2.0 — chat search, swipe for unread, faster chat opening
Desktop: - Search lists chats whose own name matches first, so a named group isn't pushed out of the top 8 by chats that merely include a member. Android (Rabbit R1) app, 0.2.0: - Pull the chat list past its top for a search box (name, person, number, then group members; archived chats too; Back clears it). - Swipe right to left marks a chat unread / read over a magenta band; left to right still archives (SwipeActions replaces SwipeArchive). - Google Voice chats don't offer voice notes in the paperclip bubble. - Chats open with their newest 60 messages, then the full history; marking read (and the Google Voice network call) waits until they're on screen. Cached pictures show at once, and one slow download no longer blocks the other images. Fixed a contacts reload race. - Sandbox data gains filler chats, a named group and a 4,000-message chat. Also: the Android app, Google Voice support, media, export, emoji and the other work since the first commit, and a CLAUDE.md carrying the privacy rule.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { emojiQuery, exactEmoji, searchEmoji } from '../src/renderer/src/emoji'
|
||||
|
||||
const at = (s: string) => emojiQuery(s, s.length)
|
||||
|
||||
describe('emojiQuery', () => {
|
||||
it('finds a shortname being typed at the start, after a space or bracket', () => {
|
||||
expect(at(':jo')).toEqual({ start: 0, query: 'jo' })
|
||||
expect(at('ha :thumb')).toEqual({ start: 3, query: 'thumb' })
|
||||
expect(at('(:+1')).toEqual({ start: 1, query: '+1' })
|
||||
})
|
||||
it('ignores times, URLs and one-letter queries', () => {
|
||||
expect(at('meet at 10:30')).toBeNull()
|
||||
expect(at('http://example')).toBeNull()
|
||||
expect(at(':a')).toBeNull()
|
||||
expect(at('ok :')).toBeNull()
|
||||
})
|
||||
it('only looks at the text before the caret', () => {
|
||||
expect(emojiQuery(':joy and more', 13)).toBeNull()
|
||||
expect(emojiQuery(':joy and more', 3)).toEqual({ start: 0, query: 'jo' })
|
||||
})
|
||||
})
|
||||
|
||||
describe('searchEmoji', () => {
|
||||
it('ranks an exact name, then prefixes, then word starts, then substrings', () => {
|
||||
expect(searchEmoji('jo')[0]).toEqual({ char: '😂', name: 'joy' })
|
||||
expect(searchEmoji('heart')[0].name).toBe('heart')
|
||||
const names = searchEmoji('cat', 50).map((m) => m.name)
|
||||
const firstWordStart = names.findIndex((n) => !n.startsWith('cat') && n.includes('_cat'))
|
||||
const firstSubstring = names.findIndex((n) => !n.startsWith('cat') && !n.includes('_cat'))
|
||||
expect(firstWordStart).toBeGreaterThan(0)
|
||||
if (firstSubstring >= 0) expect(firstSubstring).toBeGreaterThan(firstWordStart)
|
||||
})
|
||||
it('matches any of an emoji’s names, once per emoji, within the limit', () => {
|
||||
expect(searchEmoji('thumbsup').map((m) => m.char)).toContain('👍')
|
||||
const smiles = searchEmoji('smile', 5)
|
||||
expect(smiles).toHaveLength(5)
|
||||
expect(new Set(smiles.map((m) => m.char)).size).toBe(5)
|
||||
})
|
||||
})
|
||||
|
||||
describe('exactEmoji', () => {
|
||||
it('resolves full shortnames', () => {
|
||||
expect(exactEmoji('joy')).toBe('😂')
|
||||
expect(exactEmoji('+1')).toBe('👍')
|
||||
expect(exactEmoji('not_an_emoji')).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user