settings-dictionary.test.tsx 934 B

123456789101112131415161718192021222324
  1. import { fireEvent, screen, within } from '@testing-library/dom'
  2. import { expect } from 'chai'
  3. import SettingsDictionary from '../../../../../../frontend/js/features/editor-left-menu/components/settings/settings-dictionary'
  4. import { renderWithEditorContext } from '../../../../helpers/render-with-context'
  5. describe('<SettingsDictionary />', function () {
  6. it('open dictionary modal', function () {
  7. renderWithEditorContext(<SettingsDictionary />)
  8. screen.getByText('Dictionary')
  9. const button = screen.getByRole('button', { name: 'Edit' })
  10. fireEvent.click(button)
  11. const modal = screen.getAllByRole('dialog')[0]
  12. within(modal).getByRole('heading', { name: 'Edit Dictionary' })
  13. within(modal).getByText('Your custom dictionary is empty.')
  14. const doneButton = within(modal).getByRole('button', { name: 'Done' })
  15. fireEvent.click(doneButton)
  16. expect(screen.queryByRole('dialog')).to.be.null
  17. })
  18. })