help-show-hotkeys.test.jsx 777 B

1234567891011121314151617181920
  1. import { expect } from 'chai'
  2. import { screen, fireEvent, within } from '@testing-library/react'
  3. import HelpShowHotkeys from '../../../../../frontend/js/features/editor-left-menu/components/help-show-hotkeys'
  4. import { renderWithEditorContext } from '../../../helpers/render-with-context'
  5. import fetchMock from 'fetch-mock'
  6. describe('<HelpShowHotkeys />', function () {
  7. afterEach(function () {
  8. fetchMock.removeRoutes().clearHistory()
  9. })
  10. it('open hotkeys modal when clicked', function () {
  11. renderWithEditorContext(<HelpShowHotkeys />)
  12. expect(screen.queryByRole('dialog')).to.equal(null)
  13. fireEvent.click(screen.getByRole('button', { name: 'Show Hotkeys' }))
  14. const modal = screen.getAllByRole('dialog')[0]
  15. within(modal).getByText('Common')
  16. })
  17. })