settings-line-height.test.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { screen, within } from '@testing-library/dom'
  2. import { expect } from 'chai'
  3. import fetchMock from 'fetch-mock'
  4. import SettingsLineHeight from '../../../../../../frontend/js/features/editor-left-menu/components/settings/settings-line-height'
  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('<SettingsLineHeight />', function () {
  9. afterEach(function () {
  10. fetchMock.reset()
  11. })
  12. it('shows correct menu', async function () {
  13. render(
  14. <EditorProviders>
  15. <EditorLeftMenuProvider>
  16. <SettingsLineHeight />
  17. </EditorLeftMenuProvider>
  18. </EditorProviders>
  19. )
  20. const select = screen.getByLabelText('Line Height')
  21. const optionCompact = within(select).getByText('Compact')
  22. expect(optionCompact.getAttribute('value')).to.equal('compact')
  23. const optionNormal = within(select).getByText('Normal')
  24. expect(optionNormal.getAttribute('value')).to.equal('normal')
  25. const optionWide = within(select).getByText('Wide')
  26. expect(optionWide.getAttribute('value')).to.equal('wide')
  27. })
  28. })