settings-compiler.test.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { screen, within } from '@testing-library/dom'
  2. import { expect } from 'chai'
  3. import fetchMock from 'fetch-mock'
  4. import SettingsCompiler from '../../../../../../frontend/js/features/editor-left-menu/components/settings/settings-compiler'
  5. import { EditorLeftMenuProvider } from '@/features/editor-left-menu/components/editor-left-menu-context'
  6. import { render } from '@testing-library/react'
  7. import { EditorProviders } from '../../../../helpers/editor-providers'
  8. describe('<SettingsCompiler />', function () {
  9. afterEach(function () {
  10. fetchMock.reset()
  11. })
  12. it('shows correct menu', async function () {
  13. render(
  14. <EditorProviders>
  15. <EditorLeftMenuProvider>
  16. <SettingsCompiler />
  17. </EditorLeftMenuProvider>
  18. </EditorProviders>
  19. )
  20. const select = screen.getByLabelText('Compiler')
  21. const optionPdfLaTeX = within(select).getByText('pdfLaTeX')
  22. expect(optionPdfLaTeX.getAttribute('value')).to.equal('pdflatex')
  23. const optionLaTeX = within(select).getByText('LaTeX')
  24. expect(optionLaTeX.getAttribute('value')).to.equal('latex')
  25. const optionXeLaTeX = within(select).getByText('XeLaTeX')
  26. expect(optionXeLaTeX.getAttribute('value')).to.equal('xelatex')
  27. const optionLuaLaTeX = within(select).getByText('LuaLaTeX')
  28. expect(optionLuaLaTeX.getAttribute('value')).to.equal('lualatex')
  29. })
  30. })