mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-05 07:09:02 +02:00
1720ef19f4
Add frontend tests for new editor settings modal GitOrigin-RevId: a7142b5b45e9484126d159445f2dddd7d3c86584
36 lines
1.2 KiB
TypeScript
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).getAllByRole('button', {
|
|
name: 'Close',
|
|
})
|
|
fireEvent.click(closeButton)
|
|
expect(screen.getByTestId('dictionary-modal')).to.not.be.null
|
|
})
|
|
})
|