Update "go to line" hotkey for cm6 and add new info text in hotkeys modal

* Update "go to line" hotkey for cm6 and add new info text in hotkeys modal

* Differentiate modal title between cm6 and ace hotkeys

* Update test to reflect change in hotkeys modal title

* Add test for hotkeys modal bottom text

* Update test on editor left menu hotkeys button to reflect change in hotkeys modal title

GitOrigin-RevId: 61bae16313ea7a37fa3b9441dbe5a93ab7823d01
This commit is contained in:
M Fahru
2022-11-25 09:04:20 +00:00
committed by Copybot
parent 791732005c
commit 6dcc22642a
10 changed files with 81 additions and 9 deletions
@@ -15,7 +15,7 @@ describe('<HelpShowHotkeys />', function () {
expect(screen.queryByRole('dialog')).to.equal(null)
fireEvent.click(screen.getByRole('button', { name: 'Show Hotkeys' }))
const modal = screen.getAllByRole('dialog')[0]
within(modal).getByText('Hotkeys')
within(modal).getByText('Hotkeys (Legacy source editor)')
within(modal).getByText('Common')
})
})
@@ -0,0 +1,21 @@
import { render, screen } from '@testing-library/react'
import { expect } from 'chai'
import HotkeysModalBottomText from '../../../../../frontend/js/features/hotkeys-modal/components/hotkeys-modal-bottom-text'
describe('<HotkeysModalBottomText />', function () {
it('renders the correct text', function () {
render(<HotkeysModalBottomText />)
screen.getByText(
/A more comprehensive list of keyboard shortcuts can be found in/
)
const link = screen.getByRole('link', {
name: /this Overleaf project template/,
})
expect(link.getAttribute('href')).to.equal(
`/articles/overleaf-keyboard-shortcuts/qykqfvmxdnjf`
)
})
})
@@ -10,11 +10,23 @@ const modalProps = {
}
describe('<HotkeysModal />', function () {
it('renders the translated modal title', async function () {
const { baseElement } = render(<HotkeysModal {...modalProps} />)
it('renders the translated modal title on cm6', async function () {
const { baseElement } = render(
<HotkeysModal {...modalProps} newSourceEditor />
)
expect(baseElement.querySelector('.modal-title').textContent).to.equal(
'Hotkeys'
'Hotkeys (Source editor)'
)
})
it('renders the translated modal title on ace', async function () {
const { baseElement } = render(
<HotkeysModal {...modalProps} newSourceEditor={false} />
)
expect(baseElement.querySelector('.modal-title').textContent).to.equal(
'Hotkeys (Legacy source editor)'
)
})