mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-29 12:01:32 +02:00
* Replace placeholders with labels * Add 'Close dialog' label to modal close button to distinguish from footer Close button * Add and translate heading on the not found page * Update textarea to have id matching label's for attribute Simplify test for template description textarea * Label PDF zoom level dropdown button * Improve test selectors to use semantic roles and accessible names GitOrigin-RevId: d215ddca30ddf844cfffbcf0e528a601b134d772
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import {
|
|
fireEvent,
|
|
screen,
|
|
waitForElementToBeRemoved,
|
|
render,
|
|
} from '@testing-library/react'
|
|
|
|
import LeaveSection from '../../../../../frontend/js/features/settings/components/leave-section'
|
|
import getMeta from '@/utils/meta'
|
|
|
|
describe('<LeaveSection />', function () {
|
|
beforeEach(function () {
|
|
window.metaAttributesCache.set('ol-usersEmail', 'foo@bar.com')
|
|
Object.assign(getMeta('ol-ExposedSettings'), { isOverleaf: true })
|
|
window.metaAttributesCache.set('ol-hasPassword', true)
|
|
})
|
|
|
|
it('opens modal', async function () {
|
|
render(<LeaveSection />)
|
|
|
|
const button = screen.getByRole('button', {
|
|
name: 'Delete your account',
|
|
})
|
|
|
|
fireEvent.click(button)
|
|
await screen.findByText('Delete account')
|
|
})
|
|
|
|
it('closes modal', async function () {
|
|
render(<LeaveSection />)
|
|
fireEvent.click(
|
|
screen.getByRole('button', {
|
|
name: 'Delete your account',
|
|
})
|
|
)
|
|
|
|
const cancelButton = screen.getByRole('button', {
|
|
name: 'Cancel',
|
|
})
|
|
|
|
fireEvent.click(cancelButton)
|
|
|
|
await waitForElementToBeRemoved(() => screen.getByText('Delete account'))
|
|
})
|
|
})
|