font-size-setting.test.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import { screen, within, render } from '@testing-library/react'
  2. import { expect } from 'chai'
  3. import fetchMock from 'fetch-mock'
  4. import { SettingsModalProvider } from '@/features/ide-redesign/contexts/settings-modal-context'
  5. import { EditorProviders } from '../../../helpers/editor-providers'
  6. import FontSizeSetting from '@/features/ide-redesign/components/settings/appearance-settings/font-size-setting'
  7. describe('<FontSizeSetting />', function () {
  8. const sizes = ['10', '11', '12', '13', '14', '16', '18', '20', '22', '24']
  9. afterEach(function () {
  10. fetchMock.removeRoutes().clearHistory()
  11. })
  12. it('shows correct menu', async function () {
  13. render(
  14. <EditorProviders>
  15. <SettingsModalProvider>
  16. <FontSizeSetting />
  17. </SettingsModalProvider>
  18. </EditorProviders>
  19. )
  20. const select = screen.getByLabelText('Editor font size')
  21. for (const size of sizes) {
  22. const option = within(select).getByText(`${size}px`)
  23. expect(option.getAttribute('value')).to.equal(size)
  24. }
  25. })
  26. })