settings-syntax-validation.test.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import { screen, within } from '@testing-library/dom'
  2. import { expect } from 'chai'
  3. import fetchMock from 'fetch-mock'
  4. import SettingsSyntaxValidation from '../../../../../../frontend/js/features/editor-left-menu/components/settings/settings-syntax-validation'
  5. import { render } from '@testing-library/react'
  6. import { EditorProviders } from '../../../../helpers/editor-providers'
  7. import { EditorLeftMenuProvider } from '@/features/editor-left-menu/components/editor-left-menu-context'
  8. describe('<SettingsSyntaxValidation />', function () {
  9. afterEach(function () {
  10. fetchMock.reset()
  11. })
  12. it('shows correct menu', async function () {
  13. render(
  14. <EditorProviders>
  15. <EditorLeftMenuProvider>
  16. <SettingsSyntaxValidation />
  17. </EditorLeftMenuProvider>
  18. </EditorProviders>
  19. )
  20. const select = screen.getByLabelText('Code check')
  21. const optionOn = within(select).getByText('On')
  22. expect(optionOn.getAttribute('value')).to.equal('true')
  23. const optionOff = within(select).getByText('Off')
  24. expect(optionOff.getAttribute('value')).to.equal('false')
  25. })
  26. })