Extract initCopyUrl to module, add tests for copy-url and event-map coverage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 21:37:12 +01:00
parent 0cd1e0f061
commit e154713878
4 changed files with 79 additions and 14 deletions

View File

@@ -0,0 +1,13 @@
export function initCopyUrl() {
const btn = document.getElementById('copy-url-btn')
if (!btn) return
const url = document.getElementById('event-url')?.textContent?.trim()
if (!url) return
btn.addEventListener('click', () => {
globalThis.navigator.clipboard.writeText(url).then(() => {
btn.textContent = 'Copie !'
setTimeout(() => { btn.textContent = 'Copier le lien' }, 2000)
})
})
}