Add tests for editEvent, deleteEvent, toggles, and improve JS branch coverage

- Add 8 AccountController tests: editEvent GET/POST, access denied, delete, toggle online/secret, Stripe block
- Add editor.js test for text/element node handling in sanitizeNode
- Add cookie-consent test for banner without buttons (partial branch coverage)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 19:13:31 +01:00
parent 6fab96ab44
commit 23992638d3
3 changed files with 190 additions and 0 deletions

View File

@@ -49,6 +49,13 @@ describe('initCookieConsent', () => {
expect(banner.classList.contains('hidden')).toBe(true)
})
it('handles banner without buttons', () => {
document.body.innerHTML = '<div id="cookie-banner" class="hidden"></div>'
initCookieConsent()
const banner = document.getElementById('cookie-banner')
expect(banner.classList.contains('hidden')).toBe(false)
})
it('does nothing without banner element', () => {
document.body.innerHTML = ''
expect(() => initCookieConsent()).not.toThrow()

View File

@@ -110,6 +110,14 @@ describe('ETicketEditor', () => {
expect(event.defaultPrevented).toBe(true)
})
it('sanitizeNode handles text nodes and element nodes', () => {
const html = 'Hello <b>world</b> plain'
const result = sanitizeHtml(html)
expect(result).toContain('Hello')
expect(result).toContain('<b>world</b>')
expect(result).toContain('plain')
})
it('allows non-tab keys', () => {
const editor = createEditor()
const content = editor.querySelector('.ete-content')