test(chat): await Tiptap React skill-pill rendering

This commit is contained in:
m4air
2026-09-14 16:27:12 -07:00
parent 18038cfc35
commit be68ca8a01
@@ -31,9 +31,9 @@ function setup(value = '') {
}
describe('native chat skill editor', () => {
it('renders only picker insertions as pills and serializes the exact invocation', () => {
it('renders only picker insertions as pills and serializes the exact invocation', async () => {
const { input, container } = setup('Please $rev')
act(() => input.insertSkill!(7, 11, '$review'))
await act(async () => input.insertSkill!(7, 11, '$review'))
const pill = container.querySelector('[data-native-chat-skill]')
expect(pill?.textContent).toBe('Review')
expect(pill?.classList.contains('text-xs')).toBe(true)
@@ -56,7 +56,7 @@ describe('native chat skill editor', () => {
expect(container.querySelector('[data-native-chat-skill]')).toBeNull()
})
it('deletes a skill atomically and restores it with undo', () => {
it('deletes a skill atomically and restores it with undo', async () => {
const { input, editor, container } = setup('$rev')
act(() => input.insertSkill!(0, 4, '$review'))
act(() => {
@@ -65,20 +65,20 @@ describe('native chat skill editor', () => {
})
expect(input.value).toBe(' ')
expect(container.querySelector('[data-native-chat-skill]')).toBeNull()
act(() => {
await act(async () => {
editor.commands.undo()
})
expect(input.value).toBe('$review ')
expect(container.querySelector('[data-native-chat-skill]')).not.toBeNull()
})
it('preserves multiple selected skills through multiline edits and clears them on send', () => {
it('preserves multiple selected skills through multiline edits and clears them on send', async () => {
const { input, container } = setup('$one')
act(() => input.insertSkill!(0, 4, '$one'))
act(() => {
input.value += '\nthen $two'
})
act(() => input.insertSkill!(11, 15, '$two'))
await act(async () => input.insertSkill!(11, 15, '$two'))
expect(input.value).toBe('$one \nthen $two ')
expect(container.querySelectorAll('[data-native-chat-skill]')).toHaveLength(2)
act(() => {