Emoji Insertion Test - Robust Cursor Position
Test 1: Insert emoji at cursor position (middle of text)
- Type "Hello World" in the editor
- Click between "Hello" and "World" to position cursor
- Click the emoji button and select an emoji
- Expected: Emoji appears between "Hello" and "World"
Test 2: Insert emoji when editor loses focus
- Type "Hello" in the editor
- Click outside the editor (this loses focus)
- Click the emoji button and select an emoji
- Expected: Emoji appears at the end after "Hello"
Test 3: Insert emoji in empty editor
- Don't type anything
- Click the emoji button and select an emoji
- Expected: Emoji appears at position 0
Test 4: Multiple emoji insertions
- Type "ABC" in the editor
- Position cursor after "A"
- Insert an emoji
- Position cursor at the end
- Insert another emoji
- Expected: Should see "A[emoji]BC[emoji]"