Skip to content

Commit

Permalink
Refactorring
Browse files Browse the repository at this point in the history
  • Loading branch information
Vas9ka committed Jun 17, 2024
1 parent 5397abb commit 53341eb
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ jest.mock('signs/application/SignService')
const signServiceMock = new (SignService as jest.Mock<
jest.Mocked<SignService>
>)()

const description =
'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.'
describe('CuneiformConverterForm', () => {
beforeEach(() => {
Object.defineProperty(window.navigator, 'clipboard', {
Expand All @@ -24,19 +25,13 @@ describe('CuneiformConverterForm', () => {

it('renders form, options, and scenario panel correctly', () => {
render(<CuneiformConverterForm signService={signServiceMock} />)
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(description)).toBeInTheDocument()
expect(screen.getByLabelText('Select Font')).toBeInTheDocument()
expect(screen.getByLabelText('Converted Text')).toBeInTheDocument()
})
it('handles input change', () => {
render(<CuneiformConverterForm signService={signServiceMock} />)
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.'
)
const inputTextArea = screen.getByLabelText(description)
fireEvent.change(inputTextArea, { target: { value: 'test text' } })
expect(inputTextArea).toHaveValue('test text')
})
Expand All @@ -52,9 +47,7 @@ describe('CuneiformConverterForm', () => {
])
render(<CuneiformConverterForm signService={signServiceMock} />)

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.'
)
const inputTextArea = screen.getByLabelText(description)
fireEvent.change(inputTextArea, { target: { value: 'test text' } })

const convertButton = screen.getByText('Convert')
Expand Down

0 comments on commit 53341eb

Please sign in to comment.