settings-line-height.test.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import { screen, within, render } from '@testing-library/react'
  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 { EditorProviders } from '../../../../helpers/editor-providers'
  6. import { EditorLeftMenuProvider } from '@/features/editor-left-menu/components/editor-left-menu-context'
  7. describe('<SettingsLineHeight />', function () {
  8. afterEach(function () {
  9. fetchMock.reset()
  10. })
  11. it('shows correct menu', async function () {
  12. render(
  13. <EditorProviders>
  14. <EditorLeftMenuProvider>
  15. <SettingsLineHeight />
  16. </EditorLeftMenuProvider>
  17. </EditorProviders>
  18. )
  19. const select = screen.getByLabelText('Line Height')
  20. const optionCompact = within(select).getByText('Compact')
  21. expect(optionCompact.getAttribute('value')).to.equal('compact')
  22. const optionNormal = within(select).getByText('Normal')
  23. expect(optionNormal.getAttribute('value')).to.equal('normal')
  24. const optionWide = within(select).getByText('Wide')
  25. expect(optionWide.getAttribute('value')).to.equal('wide')
  26. })
  27. })