From 5397abbe432aef0870aecaef6c47752f4dc296f6 Mon Sep 17 00:00:00 2001 From: Yugay Vasiliy Date: Fri, 14 Jun 2024 11:37:24 +0000 Subject: [PATCH] * Added more fonts --- .../CuneiformConverterForm.sass | 20 ++++++++++++++----- .../CuneiformConverterForm.test.tsx | 20 +++++++++++++------ .../CuneiformConverterForm.tsx | 17 ++++++++++++---- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.sass b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.sass index f6f4124c7..1cdd519e1 100644 --- a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.sass +++ b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.sass @@ -1,6 +1,16 @@ -textarea.form-control.assurbanipal - font-size: 150% - font-family: Assurbanipal, Junicode, serif !important -textarea.form-control.neo-babylonian +textarea.form-control font-size: 150% - font-family: Neo-Babylonian,'Adobe Blank', Junicode, serif !important +textarea.form-control.assurbanipal + font-family: Assurbanipal, Junicode, serif +textarea.form-control.esagil + font-family: 'Neo-Babylonian', Junicode, serif +textarea.form-control.santakku + font-family: 'Old-Babylonian Cursive', Junicode, serif +textarea.form-control.santakkum + font-family: 'Old-Babylonian (Monumental)', Junicode, serif + +textarea.form-control.ullikummia + font-family: 'Hittite', Junicode, serif + + + diff --git a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx index 7486f7c69..3fb890bb3 100644 --- a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx +++ b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx @@ -24,21 +24,27 @@ describe('CuneiformConverterForm', () => { it('renders form, options, and scenario panel correctly', () => { render() - expect(screen.getByLabelText('Text to Convert')).toBeInTheDocument() + expect( + screen.getByLabelText( + 'This tool allows to convert transliterations to Unicode cuneiform (ranges U+12000-U+123FF, U+12400-U+1247F, and U+12480-U+1254F), using the mapping from the eBL sign list. Different fonts, developed by S. Vanseveren, can be used to display the cuneiform text.' + ) + ).toBeInTheDocument() expect(screen.getByLabelText('Select Font')).toBeInTheDocument() - expect(screen.getByLabelText('Text to Convert')).toBeInTheDocument() + expect(screen.getByLabelText('Converted Text')).toBeInTheDocument() }) it('handles input change', () => { render() - const inputTextArea = screen.getByLabelText('Text to Convert') + const inputTextArea = screen.getByLabelText( + 'This tool allows to convert transliterations to Unicode cuneiform (ranges U+12000-U+123FF, U+12400-U+1247F, and U+12480-U+1254F), using the mapping from the eBL sign list. Different fonts, developed by S. Vanseveren, can be used to display the cuneiform text.' + ) fireEvent.change(inputTextArea, { target: { value: 'test text' } }) expect(inputTextArea).toHaveValue('test text') }) it('handles font change', () => { render() const fontSelector = screen.getByLabelText('Select Font') - fireEvent.change(fontSelector, { target: { value: 'Neo-Babylonian' } }) - expect(fontSelector).toHaveValue('Neo-Babylonian') + fireEvent.change(fontSelector, { target: { value: 'Esagil' } }) + expect(fontSelector).toHaveValue('Esagil') }) it('converts text correctly', async () => { signServiceMock.getUnicodeFromAtf.mockResolvedValueOnce([ @@ -46,7 +52,9 @@ describe('CuneiformConverterForm', () => { ]) render() - const inputTextArea = screen.getByLabelText('Text to Convert') + const inputTextArea = screen.getByLabelText( + 'This tool allows to convert transliterations to Unicode cuneiform (ranges U+12000-U+123FF, U+12400-U+1247F, and U+12480-U+1254F), using the mapping from the eBL sign list. Different fonts, developed by S. Vanseveren, can be used to display the cuneiform text.' + ) fireEvent.change(inputTextArea, { target: { value: 'test text' } }) const convertButton = screen.getByText('Convert') diff --git a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx index 4c4f1446f..62913649e 100644 --- a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx +++ b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx @@ -33,7 +33,7 @@ function CuneiformConverterForm({ .map((result) => result .map((entry) => - entry.unicode[0] === 9999 ? ' ' : displayUnicode(entry.unicode) + entry.unicode[0] === 9999 ? ' ' : displayUnicode(entry.unicode) ) .join('') ) @@ -51,7 +51,7 @@ function CuneiformConverterForm({ } const handleKeyDown = (event) => { - if (event.key === 'Enter' && !event.shiftKey) { + if (event.key === 'Enter' && event.shiftKey) { event.preventDefault() handleConvert() } @@ -63,7 +63,12 @@ function CuneiformConverterForm({ return ( <> - Text to Convert + + This tool allows to convert transliterations to Unicode cuneiform + (ranges U+12000-U+123FF, U+12400-U+1247F, and U+12480-U+1254F), using + the mapping from the eBL sign list. Different fonts, developed by S. + Vanseveren, can be used to display the cuneiform text. + - + + + + +



Converted Text