From 53341eb897cfe350da1ddca0e0b7c878b367b34d Mon Sep 17 00:00:00 2001 From: Yugay Vasiliy Date: Mon, 17 Jun 2024 07:46:57 +0000 Subject: [PATCH] Refactorring --- .../CuneiformConverterForm.test.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx index 3fb890bb3..624dbac15 100644 --- a/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx +++ b/src/chronology/ui/CuneiformConverter/CuneiformConverterForm.test.tsx @@ -7,7 +7,8 @@ jest.mock('signs/application/SignService') const signServiceMock = new (SignService as jest.Mock< jest.Mocked >)() - +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', { @@ -24,19 +25,13 @@ describe('CuneiformConverterForm', () => { it('renders form, options, and scenario panel correctly', () => { render() - 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() - 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') }) @@ -52,9 +47,7 @@ describe('CuneiformConverterForm', () => { ]) render() - 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')