Files
overleaf-cep/services/web/test/frontend/features/settings-modal/settings/dictionary-setting.test.tsx
Rebeka Dekany b4bfff1b67 Improve Server Pro tests to use semantic selectors (#29790)
* Replace placeholders with labels

* Add 'Close dialog' label to modal close button to distinguish from footer Close button

* Add and translate heading on the not found page

* Update textarea to have id matching label's for attribute
Simplify test for template description textarea

* Label PDF zoom level dropdown button

* Improve test selectors to use semantic roles and accessible names

GitOrigin-RevId: d215ddca30ddf844cfffbcf0e528a601b134d772
2025-11-25 09:05:48 +00:00

36 lines
1.2 KiB
TypeScript

import { fireEvent, screen, within, render } from '@testing-library/react'
import { expect } from 'chai'
import { SettingsModalProvider } from '@/features/ide-redesign/contexts/settings-modal-context'
import { EditorProviders } from '../../../helpers/editor-providers'
import DictionarySetting from '@/features/ide-redesign/components/settings/editor-settings/dictionary-setting'
import RailModals from '@/features/ide-redesign/components/rail/rail-modals'
describe('<DictionarySetting />', function () {
it('open dictionary modal', function () {
render(
<EditorProviders>
<SettingsModalProvider>
<DictionarySetting />
<RailModals />
</SettingsModalProvider>
</EditorProviders>
)
screen.getByText('Dictionary')
const button = screen.getByText('Edit')
fireEvent.click(button)
const modal = screen.getByTestId('dictionary-modal')
within(modal).getByRole('heading', { name: 'Edit Dictionary' })
within(modal).getByText('Your custom dictionary is empty.')
const closeButton = within(modal).getByRole('button', {
name: 'Close dialog',
})
fireEvent.click(closeButton)
expect(screen.getByTestId('dictionary-modal')).to.not.be.null
})
})