settings-syntax-validation.test.tsx 1.0 KB

123456789101112131415161718192021222324252627282930
  1. import { screen, within, render } from '@testing-library/react'
  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 { EditorProviders } from '../../../../helpers/editor-providers'
  6. import { EditorLeftMenuProvider } from '@/features/editor-left-menu/components/editor-left-menu-context'
  7. describe('<SettingsSyntaxValidation />', function () {
  8. afterEach(function () {
  9. fetchMock.reset()
  10. })
  11. it('shows correct menu', async function () {
  12. render(
  13. <EditorProviders>
  14. <EditorLeftMenuProvider>
  15. <SettingsSyntaxValidation />
  16. </EditorLeftMenuProvider>
  17. </EditorProviders>
  18. )
  19. const select = screen.getByLabelText('Code check')
  20. const optionOn = within(select).getByText('On')
  21. expect(optionOn.getAttribute('value')).to.equal('true')
  22. const optionOff = within(select).getByText('Off')
  23. expect(optionOff.getAttribute('value')).to.equal('false')
  24. })
  25. })