diff --git a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx index 7781a3773..de2fcb332 100644 --- a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx +++ b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx @@ -54,4 +54,27 @@ describe('CuneiformConverterForm', () => { expect(screen.getByLabelText('Converted Text')).toHaveValue('𒃻') }) }) + + it('copies converted text to clipboard', async () => { + signServiceMock.getUnicodeFromAtf.mockResolvedValueOnce([ + { unicode: [73979] }, + ]) + + const inputTextArea = screen.getByLabelText('input-atf') + fireEvent.change(inputTextArea, { target: { value: 'test text' } }) + + const convertButton = screen.getByText('Convert') + fireEvent.click(convertButton) + + await waitFor(() => { + expect(screen.getByLabelText('Converted Text')).toHaveValue('𒃻') + }) + + const copyButton = screen.getByText('Copy') + fireEvent.click(copyButton) + + await waitFor(() => { + expect(navigator.clipboard.writeText).toHaveBeenCalledWith('𒃻') + }) + }) }) diff --git a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx index b4c21e4f2..95b4bb40e 100644 --- a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx +++ b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx @@ -61,10 +61,8 @@ function CuneiformConverterForm({ const copyToClipboard = async () => { try { await navigator.clipboard.writeText(convertedContent) - alert('Text copied to clipboard!') } catch (err) { console.error('Failed to copy text: ', err) - alert('Failed to copy text') } }