Skip to content

Commit

Permalink
* Added more fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
Vas9ka committed Jun 14, 2024
1 parent ef9a75e commit 5397abb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 15 deletions.
20 changes: 15 additions & 5 deletions src/chronology/ui/CuneiformConverter/CuneiformConverterForm.sass
Original file line number Diff line number Diff line change
@@ -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



Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,37 @@ describe('CuneiformConverterForm', () => {

it('renders form, options, and scenario panel correctly', () => {
render(<CuneiformConverterForm signService={signServiceMock} />)
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(<CuneiformConverterForm signService={signServiceMock} />)
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(<CuneiformConverterForm signService={signServiceMock} />)
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([
{ unicode: [73979] },
])
render(<CuneiformConverterForm signService={signServiceMock} />)

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')
Expand Down
17 changes: 13 additions & 4 deletions src/chronology/ui/CuneiformConverter/CuneiformConverterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
)
Expand All @@ -51,7 +51,7 @@ function CuneiformConverterForm({
}

const handleKeyDown = (event) => {
if (event.key === 'Enter' && !event.shiftKey) {
if (event.key === 'Enter' && event.shiftKey) {
event.preventDefault()
handleConvert()
}
Expand All @@ -63,7 +63,12 @@ function CuneiformConverterForm({

return (
<>
<Form.Label htmlFor="inputText">Text to Convert</Form.Label>
<Form.Label htmlFor="inputText">
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.
</Form.Label>
<Form.Control
as="textarea"
id="inputText"
Expand All @@ -83,8 +88,12 @@ function CuneiformConverterForm({
onChange={handleFontChange}
>
<option value="Assurbanipal">Neo-Assyrian</option>
<option value="Neo-Babylonian">Neo-Babylonian</option>
<option value="Esagil">Neo-Babylonian</option>
<option value="Santakku">Old Babylonian</option>
<option value="SantakkuM">Old Babylonian Monumental</option>
<option value="UllikummiA">Hittite</option>
</select>
<br></br>
<Button onClick={handleConvert}>Convert</Button>
<br></br>
<Form.Label htmlFor="outputText">Converted Text</Form.Label>
Expand Down

0 comments on commit 5397abb

Please sign in to comment.