settings-dictionary.test.tsx 955 B

1234567891011121314151617181920212223242526
  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 [, closeButton] = within(modal).getAllByRole('button', {
  15. name: 'Close',
  16. })
  17. fireEvent.click(closeButton)
  18. expect(screen.queryByRole('dialog')).to.be.null
  19. })
  20. })